[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHbLzkotGn9HifF9GQB5W5wMPZpxQviCFTStHcQCD5D37v8UVw@mail.gmail.com>
Date: Thu, 18 Jan 2024 12:39:55 -0800
From: Yang Shi <shy828301@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: jirislaby@...nel.org, surenb@...gle.com, riel@...riel.com, cl@...ux.com,
akpm@...ux-foundation.org, yang@...amperecomputing.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: huge_memory: don't force huge page alignment on 32 bit
On Thu, Jan 18, 2024 at 12:14 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Thu, Jan 18, 2024 at 05:35:04AM -0800, Yang Shi wrote:
> > It doesn't make too much sense to force huge page alignment on 32 bit
> > system due to the constrained virtual address space.
> >
> > [1] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#mf211643a0427f8d6495b5b53f8132f453d60ab95
> > [2] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#me93dff2ccbd9902c3e395e1c022fb454e48ecb1d
>
> I feel sure there are shorter URLs for those messages ...
Oh, yeah, I just found.
[1] https://lore.kernel.org/linux-mm/d0a136a0-4a31-46bc-adf4-2db109a61672@kernel.org/
[2] https://lore.kernel.org/linux-mm/CAJuCfpHXLdQy1a2B6xN2d7quTYwg2OoZseYPZTRpU0eHHKD-sQ@mail.gmail.com/
>
> > @@ -811,6 +812,14 @@ static unsigned long __thp_get_unmapped_area(struct file *filp,
> > loff_t off_align = round_up(off, size);
> > unsigned long len_pad, ret;
> >
> > + /*
> > + * It doesn't make too much sense to froce huge page alignment on
> > + * 32 bit system or compat userspace due to the contrained virtual
> > + * address space and address entropy.
> > + */
>
> I honestly wouldn't even comment this. But if you must,
>
> /* Using THP alignment is not as important as address randomisation */
It is not only about address randomization. Removing the comment is fine too.
>
> > + if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
> > + return 0;
> > +
> > if (off_end <= off_align || (off_end - off_align) < size)
> > return 0;
> >
> > --
> > 2.41.0
> >
Powered by blists - more mailing lists