From: Vlastimil Babka <vbabka@suse.cz>
To: Miaohe Lin <linmiaohe@huawei.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 7/9] mm: Free up PG_slab
Date: Fri, 22 Mar 2024 11:41:09 +0100 [thread overview]
Message-ID: <9932ecc4-a277-4d6b-94c9-1e65917235f6@suse.cz> (raw)
In-Reply-To: <d2f89d40-cbfc-a8fb-ff7b-18833260d3f1@huawei.com>
On 3/22/24 10:20, Miaohe Lin wrote:
> On 2024/3/21 22:24, Matthew Wilcox (Oracle) wrote:
>> Reclaim the Slab page flag by using a spare bit in PageType. We are
>> perennially short of page flags for various purposes, and now that
>> the original SLAB allocator has been retired, SLUB does not use the
>> mapcount/page_type field. This lets us remove a number of special cases
>> for ignoring mapcount on Slab pages.
>>
>> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
>> ---
>> include/linux/page-flags.h | 21 +++++++++++++++++----
>> include/trace/events/mmflags.h | 2 +-
>> mm/memory-failure.c | 9 ---------
>> mm/slab.h | 2 +-
>> 4 files changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
>> index 94eb8a11a321..73e0b17c7728 100644
>> --- a/include/linux/page-flags.h
>> +++ b/include/linux/page-flags.h
>> @@ -109,7 +109,6 @@ enum pageflags {
>> PG_active,
>> PG_workingset,
>> PG_error,
>> - PG_slab,
>> PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
>> PG_arch_1,
>> PG_reserved,
>> @@ -524,7 +523,6 @@ PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD)
>> TESTCLEARFLAG(Active, active, PF_HEAD)
>> PAGEFLAG(Workingset, workingset, PF_HEAD)
>> TESTCLEARFLAG(Workingset, workingset, PF_HEAD)
>> -__PAGEFLAG(Slab, slab, PF_NO_TAIL)
>> PAGEFLAG(Checked, checked, PF_NO_COMPOUND) /* Used by some filesystems */
>>
>> /* Xen */
>> @@ -931,7 +929,7 @@ PAGEFLAG_FALSE(HasHWPoisoned, has_hwpoisoned)
>> #endif
>>
>> /*
>> - * For pages that are never mapped to userspace (and aren't PageSlab),
>> + * For pages that are never mapped to userspace,
>> * page_type may be used. Because it is initialised to -1, we invert the
>> * sense of the bit, so __SetPageFoo *clears* the bit used for PageFoo, and
>> * __ClearPageFoo *sets* the bit used for PageFoo. We reserve a few high and
>> @@ -947,6 +945,7 @@ PAGEFLAG_FALSE(HasHWPoisoned, has_hwpoisoned)
>> #define PG_table 0x00000200
>> #define PG_guard 0x00000400
>> #define PG_hugetlb 0x00000800
>> +#define PG_slab 0x00001000
>>
>> #define PageType(page, flag) \
>> ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)
>> @@ -1041,6 +1040,20 @@ PAGE_TYPE_OPS(Table, table, pgtable)
>> */
>> PAGE_TYPE_OPS(Guard, guard, guard)
>>
>> +FOLIO_TYPE_OPS(slab, slab)
>> +
>> +/**
>> + * PageSlab - Determine if the page belongs to the slab allocator
>> + * @page: The page to test.
>> + *
>> + * Context: Any context.
>> + * Return: True for slab pages, false for any other kind of page.
>> + */
>> +static inline bool PageSlab(const struct page *page)
>> +{
>> + return folio_test_slab(page_folio(page));
>> +}
>> +
>> #ifdef CONFIG_HUGETLB_PAGE
>> FOLIO_TYPE_OPS(hugetlb, hugetlb)
>> #else
>> @@ -1121,7 +1134,7 @@ static __always_inline void __ClearPageAnonExclusive(struct page *page)
>> (1UL << PG_lru | 1UL << PG_locked | \
>> 1UL << PG_private | 1UL << PG_private_2 | \
>> 1UL << PG_writeback | 1UL << PG_reserved | \
>> - 1UL << PG_slab | 1UL << PG_active | \
>> + 1UL << PG_active | \
>> 1UL << PG_unevictable | __PG_MLOCKED | LRU_GEN_MASK)
>>
>> /*
>> diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
>> index d55e53ac91bd..e46d6e82765e 100644
>> --- a/include/trace/events/mmflags.h
>> +++ b/include/trace/events/mmflags.h
>> @@ -107,7 +107,6 @@
>> DEF_PAGEFLAG_NAME(lru), \
>> DEF_PAGEFLAG_NAME(active), \
>> DEF_PAGEFLAG_NAME(workingset), \
>> - DEF_PAGEFLAG_NAME(slab), \
>> DEF_PAGEFLAG_NAME(owner_priv_1), \
>> DEF_PAGEFLAG_NAME(arch_1), \
>> DEF_PAGEFLAG_NAME(reserved), \
>> @@ -135,6 +134,7 @@ IF_HAVE_PG_ARCH_X(arch_3)
>> #define DEF_PAGETYPE_NAME(_name) { PG_##_name, __stringify(_name) }
>>
>> #define __def_pagetype_names \
>> + DEF_PAGETYPE_NAME(slab), \
>> DEF_PAGETYPE_NAME(hugetlb), \
>> DEF_PAGETYPE_NAME(offline), \
>> DEF_PAGETYPE_NAME(guard), \
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index 9349948f1abf..1cb41ba7870c 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -1239,7 +1239,6 @@ static int me_huge_page(struct page_state *ps, struct page *p)
>> #define mlock (1UL << PG_mlocked)
>> #define lru (1UL << PG_lru)
>> #define head (1UL << PG_head)
>> -#define slab (1UL << PG_slab)
>> #define reserved (1UL << PG_reserved)
>>
>> static struct page_state error_states[] = {
>> @@ -1249,13 +1248,6 @@ static struct page_state error_states[] = {
>> * PG_buddy pages only make a small fraction of all free pages.
>> */
>>
>> - /*
>> - * Could in theory check if slab page is free or if we can drop
>> - * currently unused objects without touching them. But just
>> - * treat it as standard kernel for now.
>> - */
>> - { slab, slab, MF_MSG_SLAB, me_kernel },
>
> Will it be better to leave the above slab case here to catch possible unhandled obscure races with
> slab? Though it looks like slab page shouldn't reach here.
The code would need to handle page types as it's no longer a page flag. I
guess that's your decision? If it's not necessary, then I guess MF_MSG_SLAB
itself could be also removed with a buch of more code referencing it.
> Thanks.
>
next prev parent reply other threads:[~2024-03-22 10:41 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 14:24 [PATCH 0/9] Various significant MM patches Matthew Wilcox (Oracle)
2024-03-21 14:24 ` [PATCH 1/9] mm: Always initialise folio->_deferred_list Matthew Wilcox (Oracle)
2024-03-22 8:23 ` Miaohe Lin
2024-03-22 13:00 ` Matthew Wilcox
2024-04-01 3:14 ` Miaohe Lin
2024-03-22 9:30 ` Vlastimil Babka
2024-03-22 12:49 ` David Hildenbrand
2024-03-21 14:24 ` [PATCH 2/9] mm: Create FOLIO_FLAG_FALSE and FOLIO_TYPE_OPS macros Matthew Wilcox (Oracle)
2024-03-22 9:33 ` Vlastimil Babka
2024-03-21 14:24 ` [PATCH 3/9] mm: Remove folio_prep_large_rmappable() Matthew Wilcox (Oracle)
2024-03-22 9:37 ` Vlastimil Babka
2024-03-22 12:51 ` David Hildenbrand
2024-03-21 14:24 ` [PATCH 4/9] mm: Support page_mapcount() on page_has_type() pages Matthew Wilcox (Oracle)
2024-03-22 9:43 ` Vlastimil Babka
2024-03-22 12:43 ` Matthew Wilcox
2024-03-22 15:04 ` David Hildenbrand
2024-03-21 14:24 ` [PATCH 5/9] mm: Turn folio_test_hugetlb into a PageType Matthew Wilcox (Oracle)
2024-03-22 10:19 ` Vlastimil Babka
2024-03-22 15:06 ` David Hildenbrand
2024-03-23 3:24 ` Matthew Wilcox
2024-03-25 7:57 ` Vlastimil Babka
2024-03-25 18:48 ` Andrew Morton
2024-03-25 20:41 ` Matthew Wilcox
2024-03-25 20:47 ` Vlastimil Babka
2024-03-25 15:14 ` Matthew Wilcox
2024-03-25 15:18 ` Matthew Wilcox
2024-03-25 15:33 ` Matthew Wilcox
2024-03-21 14:24 ` [PATCH 6/9] mm: Remove a call to compound_head() from is_page_hwpoison() Matthew Wilcox (Oracle)
2024-03-22 10:28 ` Vlastimil Babka
2024-03-21 14:24 ` [PATCH 7/9] mm: Free up PG_slab Matthew Wilcox (Oracle)
2024-03-22 9:20 ` Miaohe Lin
2024-03-22 10:41 ` Vlastimil Babka [this message]
2024-04-01 3:38 ` Miaohe Lin
2024-03-22 15:09 ` David Hildenbrand
2024-03-25 15:19 ` Matthew Wilcox
2024-03-31 15:11 ` kernel test robot
2024-04-02 5:26 ` Matthew Wilcox
2024-03-21 14:24 ` [PATCH 8/9] mm: Improve dumping of mapcount and page_type Matthew Wilcox (Oracle)
2024-03-22 11:05 ` Vlastimil Babka
2024-03-22 15:10 ` David Hildenbrand
2024-03-21 14:24 ` [PATCH 9/9] hugetlb: Remove mention of destructors Matthew Wilcox (Oracle)
2024-03-22 11:08 ` Vlastimil Babka
2024-03-22 15:13 ` David Hildenbrand
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=9932ecc4-a277-4d6b-94c9-1e65917235f6@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=naoya.horiguchi@nec.com \
--cc=osalvador@suse.de \
--cc=willy@infradead.org \
/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