All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	linux-mm <linux-mm@kvack.org>,
	linux-api@vger.kernel.org, oleksandr@redhat.com,
	Suren Baghdasaryan <surenb@google.com>,
	Tim Murray <timmurray@google.com>,
	Sandeep Patil <sspatil@google.com>,
	Sonny Rao <sonnyrao@google.com>,
	Brian Geffon <bgeffon@google.com>, Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Shakeel Butt <shakeelb@google.com>,
	John Dias <joaodias@google.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Jann Horn <jannh@google.com>,
	alexander.h.duyck@linux.intel.com, sj38.park@gmail.com,
	Arjun Roy <arjunroy@google.com>, Vlastimil Babka <vbabka@suse.cz>,
	Jens Axboe <axboe@kernel.dk>,
	Daniel Colascione <dancol@google.com>,
	Christian Brauner <christian@brauner.io>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	SeongJae Park <sjpark@amazon.de>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH v8 1/4] mm/madvise: pass task and mm to do_madvise
Date: Wed, 24 Jun 2020 13:00:19 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2006241255180.35388@chino.kir.corp.google.com> (raw)
In-Reply-To: <20200622192900.22757-2-minchan@kernel.org>

On Mon, 22 Jun 2020, Minchan Kim wrote:

> Patch series "introduce memory hinting API for external process", v8.
> 
> Now, we have MADV_PAGEOUT and MADV_COLD as madvise hinting API.  With
> that, application could give hints to kernel what memory range are
> preferred to be reclaimed.  However, in some platform(e.g., Android), the
> information required to make the hinting decision is not known to the app.
> Instead, it is known to a centralized userspace daemon(e.g.,
> ActivityManagerService), and that daemon must be able to initiate reclaim
> on its own without any app involvement.
> 
> To solve the concern, this patch introduces new syscall -
> process_madvise(2).  Bascially, it's same with madvise(2) syscall but it
> has some differences.
> 
> 1. It needs pidfd of target process to provide the hint
> 
> 2.  It supports only MADV_{COLD|PAGEOUT|MERGEABLE|UNMEREABLE} at this
>    moment.  Other hints in madvise will be opened when there are explicit
>    requests from community to prevent unexpected bugs we couldn't support.
> 
> 3.  Only privileged processes can do something for other process's
>    address space.
> 
> For more detail of the new API, please see "mm: introduce external memory
> hinting API" description in this patchset.
> 
> This patch (of 4):
> 
> 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.
> 
> 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.
> 
> 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 passes NULL as target_task argument of do_madvise because
> it couldn't know who is target.
> 
> [1] http://lore.kernel.org/r/CAG48ez27=pwm5m_N_988xT1huO7g7h6arTQL44zev6TD-h-7Tg@mail.gmail.com
> 
> [vbabka@suse.cz: changelog tweak]
> [minchan@kernel.org: use current->mm for io_uring]
>   Link: http://lkml.kernel.org/r/20200423145215.72666-1-minchan@kernel.org
> [akpm@linux-foundation.org: fix it for upstream changes]
> [akpm@linux-foundation.org: whoops]
> [rdunlap@infradead.org: add missing includes]
> Link: http://lkml.kernel.org/r/20200302193630.68771-2-minchan@kernel.org
> Signed-off-by: Minchan Kim <minchan@kernel.org>
> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Jann Horn <jannh@google.com>
> Cc: Tim Murray <timmurray@google.com>
> Cc: Daniel Colascione <dancol@google.com>
> Cc: Sandeep Patil <sspatil@google.com>
> Cc: Sonny Rao <sonnyrao@google.com>
> Cc: Brian Geffon <bgeffon@google.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: John Dias <joaodias@google.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> Cc: SeongJae Park <sj38.park@gmail.com>
> Cc: Christian Brauner <christian@brauner.io>
> Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
> Cc: Oleksandr Natalenko <oleksandr@redhat.com>
> Cc: SeongJae Park <sjpark@amazon.de>
> Cc: Christian Brauner <christian.brauner@ubuntu.com>
> Cc: <linux-man@vger.kernel.org>

Acked-by: David Rientjes <rientjes@google.com>

  reply	other threads:[~2020-06-24 20:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 19:28 [PATCH v8 0/4] introduce memory hinting API for external process Minchan Kim
2020-06-22 19:28 ` [PATCH v8 1/4] mm/madvise: pass task and mm to do_madvise Minchan Kim
2020-06-24 20:00   ` David Rientjes [this message]
2020-06-24 20:00     ` David Rientjes
2020-06-22 19:28 ` [PATCH v8 2/4] pid: move pidfd_get_pid() to pid.c Minchan Kim
2020-06-24 20:00   ` David Rientjes
2020-06-24 20:00     ` David Rientjes
2020-06-22 19:28 ` [PATCH v8 3/4] mm/madvise: introduce process_madvise() syscall: an external memory hinting API Minchan Kim
2020-06-24 20:00   ` David Rientjes
2020-06-24 20:00     ` David Rientjes
2020-06-25 20:38     ` Minchan Kim
2020-08-28 17:40   ` Arnd Bergmann
2020-08-28 17:40     ` Arnd Bergmann
2020-08-28 18:24     ` Jens Axboe
2020-08-28 18:25       ` Christian Brauner
2020-08-28 18:25         ` Christian Brauner
2020-08-28 19:04         ` Minchan Kim
2020-08-28 19:26       ` Jens Axboe
2020-08-28 20:15         ` Arnd Bergmann
2020-08-28 20:15           ` Arnd Bergmann
2020-08-29  7:02     ` Christoph Hellwig
2020-06-22 19:29 ` [PATCH v8 4/4] mm/madvise: check fatal signal pending of target process Minchan Kim
2020-06-24 20:00   ` David Rientjes
2020-06-24 20:00     ` David Rientjes
2020-06-22 19:36 ` [PATCH v8 0/4] introduce memory hinting API for external process Minchan Kim
2020-06-23  8:59   ` Oleksandr Natalenko
2020-06-23  9:07 ` Oleksandr Natalenko
2020-06-24  1:31   ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2006241255180.35388@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=arjunroy@google.com \
    --cc=axboe@kernel.dk \
    --cc=bgeffon@google.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=christian@brauner.io \
    --cc=dancol@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=jannh@google.com \
    --cc=joaodias@google.com \
    --cc=joel@joelfernandes.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=oleksandr@redhat.com \
    --cc=shakeelb@google.com \
    --cc=sj38.park@gmail.com \
    --cc=sjpark@amazon.de \
    --cc=sonnyrao@google.com \
    --cc=sspatil@google.com \
    --cc=surenb@google.com \
    --cc=timmurray@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.