From: Alexander Duyck <alexander.duyck@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.com>,
Pavel Tatashin <pavel.tatashin@microsoft.com>,
Alexander Potapenko <glider@google.com>,
Arnd Bergmann <arnd@arndb.de>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
John Hubbard <jhubbard@nvidia.com>,
Naoya Horiguchi <naoya.horiguchi@nec.com>,
Hugh Dickins <hughd@google.com>,
Suren Baghdasaryan <surenb@google.com>,
Alex Sierra <alex.sierra@amd.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: extend max struct page size for kmsan
Date: Mon, 30 Jan 2023 08:29:41 -0800 [thread overview]
Message-ID: <CAKgT0Ufh7bGh360GUgbSCwysmd=L2B_V2X8SGtF94CzAqCA9_Q@mail.gmail.com> (raw)
In-Reply-To: <20230130130739.563628-1-arnd@kernel.org>
On Mon, Jan 30, 2023 at 5:07 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> After x86 has enabled support for KMSAN, it has become possible
> to have larger 'struct page' than was expected when commit
> 5470dea49f53 ("mm: use mm_zero_struct_page from SPARC on all 64b
> architectures") was merged:
>
> include/linux/mm.h:156:10: warning: no case matching constant switch condition '96'
> switch (sizeof(struct page)) {
>
> Extend the maximum accordingly.
>
> Fixes: 5470dea49f53 ("mm: use mm_zero_struct_page from SPARC on all 64b architectures")
> Fixes: 4ca8cc8d1bbe ("x86: kmsan: enable KMSAN builds for x86")
Rather than saying this fixes the code that enables the config flags I
might be more comfortable with listing the commit that added the two
pointers to the struct:
Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core")
It will make it easier to identify where the lines where added that
actually increased the size of the page struct.
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This seems to show up extremely rarely in randconfig builds, but
> enough to trigger my build machine.
>
> I saw a related discussion at [1] about raising MAX_STRUCT_PAGE_SIZE,
> but as I understand it, that needs to be addressed separately.
>
> [1] https://lore.kernel.org/lkml/20220701142310.2188015-11-glider@google.com/
> ---
> include/linux/mm.h | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index b73ba2e5cfd2..aa39d5ddace1 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -137,7 +137,7 @@ extern int mmap_rnd_compat_bits __read_mostly;
> * define their own version of this macro in <asm/pgtable.h>
> */
> #if BITS_PER_LONG == 64
> -/* This function must be updated when the size of struct page grows above 80
> +/* This function must be updated when the size of struct page grows above 96
> * or reduces below 56. The idea that compiler optimizes out switch()
> * statement, and only leaves move/store instructions. Also the compiler can
> * combine write statements if they are both assignments and can be reordered,
> @@ -148,12 +148,18 @@ static inline void __mm_zero_struct_page(struct page *page)
> {
> unsigned long *_pp = (void *)page;
>
> - /* Check that struct page is either 56, 64, 72, or 80 bytes */
> + /* Check that struct page is either 56, 64, 72, 80, 88 or 96 bytes */
> BUILD_BUG_ON(sizeof(struct page) & 7);
> BUILD_BUG_ON(sizeof(struct page) < 56);
> - BUILD_BUG_ON(sizeof(struct page) > 80);
> + BUILD_BUG_ON(sizeof(struct page) > 96);
>
> switch (sizeof(struct page)) {
> + case 96:
> + _pp[11] = 0;
> + fallthrough;
> + case 88:
> + _pp[10] = 0;
> + fallthrough;
> case 80:
> _pp[9] = 0;
> fallthrough;
Otherwise the code itself looks good to me.
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
next prev parent reply other threads:[~2023-01-30 16:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 13:07 Arnd Bergmann
2023-01-30 13:38 ` Michal Hocko
2023-01-30 16:47 ` Matthew Wilcox
2023-01-30 18:20 ` Alexander Potapenko
2023-01-30 17:59 ` Alexander Potapenko
2023-01-31 15:14 ` Michal Hocko
2023-01-31 15:17 ` Alexander Potapenko
2023-01-31 16:03 ` Alexander Potapenko
2023-01-30 16:29 ` Alexander Duyck [this message]
2023-01-30 17:19 ` Pasha Tatashin
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='CAKgT0Ufh7bGh360GUgbSCwysmd=L2B_V2X8SGtF94CzAqCA9_Q@mail.gmail.com' \
--to=alexander.duyck@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alex.sierra@amd.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=david@redhat.com \
--cc=glider@google.com \
--cc=hughd@google.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=naoya.horiguchi@nec.com \
--cc=pavel.tatashin@microsoft.com \
--cc=surenb@google.com \
--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