linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>, "Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Dave Chinner" <david@fromorbit.com>,
	"Qi Zheng" <zhengqi.arch@bytedance.com>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Muchun Song" <muchun.song@linux.dev>,
	"David Hildenbrand" <david@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	kernel-team@android.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-mm@kvack.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 3/5] mm: export zap_page_range_single and list_lru_add/del
Date: Thu, 5 Feb 2026 11:29:04 +0000	[thread overview]
Message-ID: <02801464-f4cb-4e38-8269-f8b9cf0a5965@lucifer.local> (raw)
In-Reply-To: <20260205-binder-tristate-v1-3-dfc947c35d35@google.com>

On Thu, Feb 05, 2026 at 10:51:28AM +0000, Alice Ryhl wrote:
> These are the functions needed by Binder's shrinker.
>
> Binder uses zap_page_range_single in the shrinker path to remove an
> unused page from the mmap'd region. Note that pages are only removed
> from the mmap'd region lazily when shrinker asks for it.
>
> Binder uses list_lru_add/del to keep track of the shrinker lru list, and
> it can't use _obj because the list head is not stored inline in the page
> actually being lru freed, so page_to_nid(virt_to_page(item)) on the list
> head computes the nid of the wrong page.
>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
>  mm/list_lru.c | 2 ++
>  mm/memory.c   | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/mm/list_lru.c b/mm/list_lru.c
> index ec48b5dadf519a5296ac14cda035c067f9e448f8..bf95d73c9815548a19db6345f856cee9baad22e3 100644
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -179,6 +179,7 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item, int nid,
>  	unlock_list_lru(l, false);
>  	return false;
>  }
> +EXPORT_SYMBOL_GPL(list_lru_add);
>
>  bool list_lru_add_obj(struct list_lru *lru, struct list_head *item)
>  {
> @@ -216,6 +217,7 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item, int nid,
>  	unlock_list_lru(l, false);
>  	return false;
>  }
> +EXPORT_SYMBOL_GPL(list_lru_del);

Same point as before about exporting symbols, but given the _obj variants are
exported already this one is more valid.

>
>  bool list_lru_del_obj(struct list_lru *lru, struct list_head *item)
>  {
> diff --git a/mm/memory.c b/mm/memory.c
> index da360a6eb8a48e29293430d0c577fb4b6ec58099..64083ace239a2caf58e1645dd5d91a41d61492c4 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2168,6 +2168,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
>  	zap_page_range_single_batched(&tlb, vma, address, size, details);
>  	tlb_finish_mmu(&tlb);
>  }
> +EXPORT_SYMBOL(zap_page_range_single);

Sorry but I don't want this exported at all.

This is an internal implementation detail which allows fine-grained control of
behaviour via struct zap_details (which binder doesn't use, of course :)

We either need a wrapper that eliminates this parameter (but then we're adding a
wrapper to this behaviour that is literally for one driver that is _temporarily_
being modularised which is weak justifiction), or use of a function that invokes
it that is currently exported.

Again the general policy with exports is that we really don't want to provide
them at all if we can help it, and if we do, only when it's really justified.

Drivers by nature generally abuse any interfaces provided, we reduce the surface
area of bugs in the kernel by minimising what's available (even via header for
in-tree...)

>
>  /**
>   * zap_vma_ptes - remove ptes mapping the vma
>
> --
> 2.53.0.rc2.204.g2597b5adb4-goog
>

Cheers, Lorenzo


  parent reply	other threads:[~2026-02-05 11:30 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 10:51 [PATCH 0/5] Make Rust Binder build as a module Alice Ryhl
2026-02-05 10:51 ` [PATCH 1/5] export file_close_fd and task_work_add Alice Ryhl
2026-02-05 11:20   ` Lorenzo Stoakes
2026-02-05 11:42     ` Alice Ryhl
2026-02-05 11:53       ` Lorenzo Stoakes
2026-02-05 13:45         ` Alice Ryhl
2026-02-09 15:21           ` Lorenzo Stoakes
2026-02-10  8:47             ` Alice Ryhl
2026-02-05 11:38   ` Christian Brauner
2026-02-05 11:52     ` Jan Kara
2026-02-05 12:07       ` Alice Ryhl
2026-02-05 10:51 ` [PATCH 2/5] security: export binder symbols Alice Ryhl
2026-02-20  0:00   ` Paul Moore
2026-02-05 10:51 ` [PATCH 3/5] mm: export zap_page_range_single and list_lru_add/del Alice Ryhl
2026-02-05 10:59   ` David Hildenbrand (arm)
2026-02-05 11:04     ` Alice Ryhl
2026-02-05 11:12       ` David Hildenbrand (arm)
2026-02-05 11:18         ` Alice Ryhl
2026-02-05 11:30           ` David Hildenbrand (arm)
2026-02-05 11:29   ` Lorenzo Stoakes [this message]
2026-02-05 11:43     ` David Hildenbrand (arm)
2026-02-05 11:57       ` David Hildenbrand (arm)
2026-02-05 12:01         ` Lorenzo Stoakes
2026-02-05 12:06           ` David Hildenbrand (arm)
2026-02-05 12:07             ` Lorenzo Stoakes
2026-02-05 11:57       ` Lorenzo Stoakes
2026-02-05 12:03         ` David Hildenbrand (arm)
2026-02-05 12:12           ` Lorenzo Stoakes
2026-02-05 12:24         ` Miguel Ojeda
2026-02-05 12:28           ` Lorenzo Stoakes
2026-02-05 11:58       ` Alice Ryhl
2026-02-05 12:10         ` Lorenzo Stoakes
2026-02-05 12:13           ` David Hildenbrand (arm)
2026-02-05 12:19             ` Alice Ryhl
2026-02-05 12:24               ` Lorenzo Stoakes
2026-02-05 12:30                 ` David Hildenbrand (Arm)
2026-02-09 15:22                   ` Lorenzo Stoakes
2026-02-05 12:16           ` Alice Ryhl
2026-02-05 12:07     ` Alice Ryhl
2026-02-05 12:18       ` Lorenzo Stoakes
2026-02-05 10:51 ` [PATCH 4/5] ipc: export init_ipc_ns and put_ipc_ns Alice Ryhl
2026-02-05 10:51 ` [PATCH 5/5] rust_binder: mark ANDROID_BINDER_IPC_RUST tristate Alice Ryhl
2026-02-05 13:21   ` Gary Guo

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=02801464-f4cb-4e38-8269-f8b9cf0a5965@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=david@fromorbit.com \
    --cc=david@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jack@suse.cz \
    --cc=jmorris@namei.org \
    --cc=kernel-team@android.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=ojeda@kernel.org \
    --cc=paul@paul-moore.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=surenb@google.com \
    --cc=tmgross@umich.edu \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zhengqi.arch@bytedance.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox