[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250611175907.197023-1-sj@kernel.org>
Date: Wed, 11 Jun 2025 10:59:07 -0700
From: SeongJae Park <sj@...nel.org>
To: Barry Song <21cnbao@...il.com>
Cc: SeongJae Park <sj@...nel.org>,
akpm@...ux-foundation.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Barry Song <v-songbaohua@...o.com>,
David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Jann Horn <jannh@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Lokesh Gidra <lokeshgidra@...gle.com>,
Mike Rapoport <rppt@...nel.org>,
Michal Hocko <mhocko@...e.com>,
Tangquan Zheng <zhengtangquan@...o.com>,
Qi Zheng <zhengqi.arch@...edance.com>
Subject: Re: [PATCH v2] mm: madvise: use per_vma lock for MADV_FREE
On Wed, 11 Jun 2025 22:47:45 +1200 Barry Song <21cnbao@...il.com> wrote:
> From: Barry Song <v-songbaohua@...o.com>
>
> MADV_FREE is another option, besides MADV_DONTNEED, for dynamic memory
> freeing in user-space native or Java heap memory management. For example,
> jemalloc can be configured to use MADV_FREE, and recent versions of the
> Android Java heap have also increasingly adopted MADV_FREE. Supporting
> per-VMA locking for MADV_FREE thus appears increasingly necessary.
>
> We have replaced walk_page_range() with walk_page_range_vma(). Along with
> the proposed madvise_lock_mode by Lorenzo, the necessary infrastructure is
> now in place to begin exploring per-VMA locking support for MADV_FREE and
> potentially other madvise using walk_page_range_vma().
>
> This patch adds support for the PGWALK_VMA_RDLOCK walk_lock mode in
> walk_page_range_vma(), and leverages madvise_lock_mode from
> madv_behavior to select the appropriate walk_lock—either mmap_lock or
> per-VMA lock—based on the context.
>
> Because we now dynamically update the walk_ops->walk_lock field, we
> must ensure this is thread-safe. The madvise_free_walk_ops is now
> defined as a stack variable instead of a global constant.
>
> Acked-by: David Hildenbrand <david@...hat.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> Cc: "Liam R. Howlett" <Liam.Howlett@...cle.com>
> Cc: Vlastimil Babka <vbabka@...e.cz>
> Cc: Jann Horn <jannh@...gle.com>
> Cc: Suren Baghdasaryan <surenb@...gle.com>
> Cc: Lokesh Gidra <lokeshgidra@...gle.com>
> Cc: Mike Rapoport <rppt@...nel.org>
> Cc: Michal Hocko <mhocko@...e.com>
> Cc: Tangquan Zheng <zhengtangquan@...o.com>
> Cc: Qi Zheng <zhengqi.arch@...edance.com>
> Signed-off-by: Barry Song <v-songbaohua@...o.com>
Acked-by: SeongJae Park <sj@...nel.org>
Thanks,
SJ
[...]
Powered by blists - more mailing lists