Thread (43 messages) flat view 43 messages, 8 authors, 2020-06-11

Re: [PATCH v7 1/7] mm: pass task and mm to do_madvise

From: Minchan Kim <minchan@kernel.org>
Date: 2020-05-08 18:21:48
Also in: linux-mm, lkml

On Thu, Mar 05, 2020 at 04:48:12PM +0100, Vlastimil Babka wrote:
On 3/2/20 8:36 PM, Minchan Kim wrote:
quoted
In upcoming patches, do_madvise will be called from external process
context so we shouldn't asssume "current" is always hinted process's
task_struct.
quoted
Furthermore, we couldn't access mm_struct via task->mm
once it's verified by access_mm which will be introduced in next
patch[1].
I would suggest to replace with:

Furthermore, we must not access mm_struct via task->mm, but obtain it via
access_mm() once (in the following patch) and only use that pointer [1], so pass
it to do_madvise() as well. Note the vma->vm_mm pointers are safe, so we can use
them further down the call stack.
quoted
And let's pass *current* and current->mm as arguments of
do_madvise so it shouldn't change existing behavior but prepare
next patch to make review easy.

Note: io_madvise pass NULL as target_task argument of do_madvise
because it couldn't know who is target.
             can't
Andrew already picked up your suggestion except "can't" part. I don't
think it's enough to resend fix it so I will leave it as-is.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help