Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag
From: Michal Hocko
Date: Thu Aug 13 2020 - 03:18:12 EST
On Wed 12-08-20 13:38:35, Thomas Gleixner wrote:
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> writes:
> > Thomas Gleixner <tglx@xxxxxxxxxxxxx> writes:
> >> Michal Hocko <mhocko@xxxxxxxx> writes:
> >>> zone->lock should be held for a very limited amount of time.
> >>
> >> Emphasis on should. free_pcppages_bulk() can hold it for quite some time
> >> when a large amount of pages are purged. We surely would have converted
> >> it to a raw lock long time ago otherwise.
> >>
> >> For regular enterprise stuff a few hundred microseconds might qualify as
> >> a limited amount of time. For advanced RT applications that's way beyond
> >> tolerable..
> >
> > Sebastian just tried with zone lock converted to a raw lock and maximum
> > latencies go up by a factor of 7 when putting a bit of stress on the
> > memory subsytem. Just a regular kernel compile kicks them up by a factor
> > of 5. Way out of tolerance.
> >
> > We'll have a look whether it's solely free_pcppages_bulk() and if so we
> > could get away with dropping the lock in the loop.
>
> So even on !RT and just doing a kernel compile the time spent in
> free_pcppages_bulk() is up to 270 usec.
>
> It's not only the loop which processes a large pile of pages, part of it
> is caused by lock contention on zone->lock. Dropping the lock after a
> processing a couple of pages does not make it much better if enough CPUs
> are contending on the lock.
OK, this is a bit surprising to me but well, reality sucks sometimes.
I was really hoping for a solution which would allow the allocator to
really do what gfp flags say and if something is nowait then it
shouldn't really block. I believe we need to document this properly.
I will comment on the dedicated gfp flag in reply to other email.
Thanks for trying that out Sebastian and Thomas!
--
Michal Hocko
SUSE Labs