lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bC_LKeffiYq8eraM-rLBFPfUS1034eD6FKQo5eR7s28Ew@mail.gmail.com>
Date:   Sun, 31 Jan 2021 11:03:32 -0500
From:   Pavel Tatashin <pasha.tatashin@...een.com>
To:     Lecopzer Chen <lecopzer@...il.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Dan Williams <dan.j.williams@...el.com>,
        David Hildenbrand <david@...hat.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Ira Weiny <ira.weiny@...el.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        John Hubbard <jhubbard@...dia.com>,
        James Morris <jmorris@...ei.org>,
        Linux Doc Mailing List <linux-doc@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-kselftest@...r.kernel.org, linux-mm <linux-mm@...ck.org>,
        Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...e.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Ingo Molnar <mingo@...hat.com>,
        Oscar Salvador <osalvador@...e.de>,
        Peter Zijlstra <peterz@...radead.org>,
        David Rientjes <rientjes@...gle.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sasha Levin <sashal@...nel.org>,
        Tyler Hicks <tyhicks@...ux.microsoft.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v8 07/14] mm: honor PF_MEMALLOC_PIN for all movable pages

On Sun, Jan 31, 2021 at 8:09 AM Lecopzer Chen <lecopzer@...il.com> wrote:
>
>
> Hi,
>
> [...]
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index c93e801a45e9..3f17c73ad582 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3807,16 +3807,13 @@ alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
> >       return alloc_flags;
> >  }
> >
> > -static inline unsigned int current_alloc_flags(gfp_t gfp_mask,
> > -                                     unsigned int alloc_flags)
> > +/* Must be called after current_gfp_context() which can change gfp_mask */
> > +static inline unsigned int gpf_to_alloc_flags(gfp_t gfp_mask,
> > +                                           unsigned int alloc_flags)
> >  {
> >  #ifdef CONFIG_CMA
> > -     unsigned int pflags = current->flags;
> > -
> > -     if (!(pflags & PF_MEMALLOC_PIN) &&
> > -         gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
> > +     if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
> >               alloc_flags |= ALLOC_CMA;
> > -
> >  #endif
> >       return alloc_flags;
> >  }
> > @@ -4472,7 +4469,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
> >       } else if (unlikely(rt_task(current)) && !in_interrupt())
> >               alloc_flags |= ALLOC_HARDER;
> >
> > -     alloc_flags = current_alloc_flags(gfp_mask, alloc_flags);
> > +     alloc_flags = gpf_to_alloc_flags(gfp_mask, alloc_flags);
> >
> >       return alloc_flags;
> >  }
> > @@ -4774,7 +4771,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
> >
> >       reserve_flags = __gfp_pfmemalloc_flags(gfp_mask);
> >       if (reserve_flags)
> > -             alloc_flags = current_alloc_flags(gfp_mask, reserve_flags);
> > +             alloc_flags = gpf_to_alloc_flags(gfp_mask, reserve_flags);
> >
> >       /*
> >        * Reset the nodemask and zonelist iterators if memory policies can be
> > @@ -4943,7 +4940,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
> >       if (should_fail_alloc_page(gfp_mask, order))
> >               return false;
> >
> > -     *alloc_flags = current_alloc_flags(gfp_mask, *alloc_flags);
> > +     *alloc_flags = gpf_to_alloc_flags(gfp_mask, *alloc_flags);
>
> I have a question, what is the abbreviation of "gpf" in the function
> name gpf_to_alloc_flags()?
>
> It seems that this function still use gfp_mask, is this supposed
> to be gfp (Get Free Page)?

Thank you for noticing this, it was accidental, I will rename the
function gpf_to_alloc_flags() -> gfp_to_alloc_flags()

>
> Thanks,
> Lecopzer
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ