[PATCH v2 0/2] frozen pages for large kmalloc

Vlastimil Babka posted 2 patches 6 months, 2 weeks ago
include/linux/mm.h | 4 +++-
mm/slub.c          | 9 +++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
[PATCH v2 0/2] frozen pages for large kmalloc
Posted by Vlastimil Babka 6 months, 2 weeks ago
In [1] I have suggested we start warning for get_page() done on large
kmalloc pages as the first step to convert them to frozen pages.
We exposed to -next and indeed got such a warning [2]. But it turns out
the code is using sendpage_ok() and thus would avoid the get_page() if
the page was actually frozen.

So in this version, freeze the large kmalloc pages at the same time as
adding the warnings and refusals to get_page/put_page() on large kmalloc
pages, the same as we do for slab pages - in patch 2.

While doing that I've noticed that large kmalloc doesn't observe NUMA
policies, while the rest of the allocator does. This turns out to be a
regression from v6.1, so I'm restoring that first in patch 1. There is
no Cc: stable as it's not fixing a critical bug, but we can submit it to
e.g. latest LTSS afterwards.

Given the timing I would expose this to -next after the current merge
window closes, thus towards 6.17.

[1] https://lore.kernel.org/all/20250417074102.4543-2-vbabka@suse.cz/
[2] https://lore.kernel.org/all/202505221248.595a9117-lkp@intel.com/

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
Changes in v2:
- Reword commit log of patch 1 to acknowledge it's restoring pre-6.1
  behavior, add Fixes:
- Change the order of the two patches to allow possible backport of the
  NUMA fix.
- Link to v1: https://patch.msgid.link/20250529-frozen-pages-for-large-kmalloc-v1-0-b3aa52a8fa17@suse.cz

---
Vlastimil Babka (2):
      mm, slab: restore NUMA policy support for large kmalloc
      mm, slab: use frozen pages for large kmalloc

 include/linux/mm.h | 4 +++-
 mm/slub.c          | 9 +++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
---
base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
change-id: 20250529-frozen-pages-for-large-kmalloc-bd4d2522e52b

Best regards,
-- 
Vlastimil Babka <vbabka@suse.cz>
Re: [PATCH v2 0/2] frozen pages for large kmalloc
Posted by Vlastimil Babka 6 months ago
On 6/2/25 13:02, Vlastimil Babka wrote:
> In [1] I have suggested we start warning for get_page() done on large
> kmalloc pages as the first step to convert them to frozen pages.
> We exposed to -next and indeed got such a warning [2]. But it turns out
> the code is using sendpage_ok() and thus would avoid the get_page() if
> the page was actually frozen.
> 
> So in this version, freeze the large kmalloc pages at the same time as
> adding the warnings and refusals to get_page/put_page() on large kmalloc
> pages, the same as we do for slab pages - in patch 2.
> 
> While doing that I've noticed that large kmalloc doesn't observe NUMA
> policies, while the rest of the allocator does. This turns out to be a
> regression from v6.1, so I'm restoring that first in patch 1. There is
> no Cc: stable as it's not fixing a critical bug, but we can submit it to
> e.g. latest LTSS afterwards.
> 
> Given the timing I would expose this to -next after the current merge
> window closes, thus towards 6.17.

It's now in slab/for-next. Went with Cc: stable for the first patch in the
end. Thanks for the reviews!

> [1] https://lore.kernel.org/all/20250417074102.4543-2-vbabka@suse.cz/
> [2] https://lore.kernel.org/all/202505221248.595a9117-lkp@intel.com/
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> Changes in v2:
> - Reword commit log of patch 1 to acknowledge it's restoring pre-6.1
>   behavior, add Fixes:
> - Change the order of the two patches to allow possible backport of the
>   NUMA fix.
> - Link to v1: https://patch.msgid.link/20250529-frozen-pages-for-large-kmalloc-v1-0-b3aa52a8fa17@suse.cz
> 
> ---
> Vlastimil Babka (2):
>       mm, slab: restore NUMA policy support for large kmalloc
>       mm, slab: use frozen pages for large kmalloc
> 
>  include/linux/mm.h | 4 +++-
>  mm/slub.c          | 9 +++++++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
> ---
> base-commit: 9c32cda43eb78f78c73aee4aa344b777714e259b
> change-id: 20250529-frozen-pages-for-large-kmalloc-bd4d2522e52b
> 
> Best regards,