[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHbLzkq_ZSoA-DT=qtENMNpU1cgVacXsyWDjLxGFHzsn7bFXNg@mail.gmail.com>
Date: Thu, 18 Jan 2024 10:42:12 -0800
From: Yang Shi <shy828301@...il.com>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: Jiri Slaby <jirislaby@...nel.org>, Rik van Riel <riel@...riel.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-team@...com,
Matthew Wilcox <willy@...radead.org>, Christoph Lameter <cl@...ux.com>
Subject: Re: [PATCH v2] mm: align larger anonymous mappings on THP boundaries
On Thu, Jan 18, 2024 at 9:48 AM Suren Baghdasaryan <surenb@...gle.com> wrote:
>
> On Wed, Jan 17, 2024 at 11:05 PM Jiri Slaby <jirislaby@...nel.org> wrote:
> >
> > On 18. 01. 24, 1:07, Yang Shi wrote:
> > >> This works around the problem, of course (but is a band-aid, not a fix):
> > >>
> > >> --- a/mm/mmap.c
> > >> +++ b/mm/mmap.c
> > >> @@ -1829,7 +1829,7 @@ get_unmapped_area(struct file *file, unsigned long
> > >> addr, unsigned long len,
> > >> */
> > >> pgoff = 0;
> > >> get_area = shmem_get_unmapped_area;
> > >> - } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
> > >> + } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
> > >> !in_32bit_syscall()) {
> > >> /* Ensures that larger anonymous mappings are THP
> > >> aligned. */
> > >> get_area = thp_get_unmapped_area;
> > >> }
> > >>
> > >>
> > >> thp_get_unmapped_area() does not take care of the legacy stuff...
> > >
> > > Could you please help test the below patch? It is compiled, but I
> > > don't have 32 bit userspace or machine to test it.
> >
> > Yeah, for x86_64, it's semantically the same as the above, so this works
> > too:
> >
> > Tested-by: Jiri Slaby <jirislaby@...nel.org>
>
> With the addition of #include <linux/compat.h> it builds and passes
> our tests as well. Thanks!
>
> Tested-by: Suren Baghdasaryan <surenb@...gle.com>
Thanks for checking the test case and testing the patch. I will fix it
and post the formal patch.
>
> >
> > > --- a/mm/huge_memory.c
> > > +++ b/mm/huge_memory.c
> > > @@ -811,6 +811,9 @@ static unsigned long
> > > __thp_get_unmapped_area(struct file *filp,
> > > loff_t off_align = round_up(off, size);
> > > unsigned long len_pad, ret;
> > >
> > > + if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
> > > + return 0;
> > > +
> > > if (off_end <= off_align || (off_end - off_align) < size)
> > > return 0;
> >
> > thanks,
> > --
> > js
> > suse labs
> >
> >
Powered by blists - more mailing lists