Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag

From: Uladzislau Rezki
Date: Thu Aug 13 2020 - 10:22:52 EST

On Thu, Aug 13, 2020 at 03:41:39PM +0200, Michal Hocko wrote:
> On Thu 13-08-20 15:29:31, Uladzislau Rezki wrote:
> [...]
> > I was a bit out of focus and did not mention about one thing. Identifying the context
> > type using preemtable() primitives looks a bit not suitable, IMHO. GFP_* flags are
> > not supposed to identify a context type, because it is not possible for all cases.
> Yes, GFP flags do not identify context and that is why my draft didn't
> really consider gfp flags for anything but the retry logic which is
> already gfp based already. The buddy allocator path simply always bails
> out for those rt atomic paths whenever it gets close to zone->lock
> > But that i
> You meant to say more I guess
Ahh. Right. It was not completed. The idea was that we do not really need
to identify preemptible we are or not. Unless we want to help RT to proceed
further, based on if "RT && preemtable()", allowing to take zone->lock and
improve a chance of to be succeed with allocation. Basically not bail out.

> > Also, to bail out based on a context's type will not allow to get a page from atomic
> > contexts, what we try to achieve :)
> Yes lockdep will need some special treatment but I suspect we want to
> address the underlying problem first and only then take care of the
> lockdep.
> > Whereas, i mean, we do have possibility to do lock-less per-cpu-list allocation without
> > touching any zone lock.
> >
> > if (gfp_mask == 0) {
> > check_pcp_lists();
> > if (page)
> > return page;
> >
> > bail out here without doing farther logic, like pre-fetching.
> > return NULL;
> > }
> The existing code does that already. __rmqueue_pcplist will go
> rmqueue_bulk only when pcp lists are empty. Or did I miss your point?
Right. Probably we look at it from different angles :) Right, when
pcp is empty the zone->lock is accessed.

I got the feeling that you want to bail out based on the if (RT && !preemptible()) -> bail out
i.e. On RT below code will always return NULL:



Vlad Rezki