Re: [PATCH v7 5/7] mm: support both pid and pidfd for process_madvise

From
Minchan Kim <minchan@kernel.org>
Date
2020-03-11 00:42:57
Also in
linux-mm, lkml
Reply to
Vlastimil Babka, 2020-03-06
On Fri, Mar 06, 2020 at 12:14:19PM +0100, Vlastimil Babka wrote:
On 3/2/20 8:36 PM, Minchan Kim wrote:
quoted
There is a demand[1] to support pid as well pidfd for process_madvise
to reduce unnecessary syscall to get pidfd if the user has control of
the target process(ie, they could guarantee the process is not gone
or pid is not reused).

This patch aims for supporting both options like waitid(2). So, the
syscall is currently,

	int process_madvise(int which, pid_t pid, void *addr,
		size_t length, int advise, unsigned long flag);
This is again halfway between kernel and userspace description, so if we stick
to userspace then it's:

 	int process_madvise(idtype_t idtype, id_t id, void *addr,
 		size_t length, int advice, unsigned long flags);
Yub.
quoted
@which is actually idtype_t for userspace libray and currently,
it supports P_PID and P_PIDFD.

[1]  https://lore.kernel.org/linux-mm/9d849087-3359-c4ab-fbec-859e8186c509@virtuozzo.com/ (local)

Cc: Christian Brauner <christian@brauner.io>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Kirill Tkhai <redacted>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Vlastimil Babka <redacted>
Thanks!
Thread (43 messages) 43 messages, 8 authors, last reply 2020-06-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help