Re: [dm-devel] [RFC PATCH 2/2] mm, mempool: do not throttle PF_LESS_THROTTLE tasks

From: Michal Hocko
Date: Wed Aug 03 2016 - 10:42:39 EST


On Wed 03-08-16 09:59:11, Mikulas Patocka wrote:
>
>
> On Wed, 27 Jul 2016, Michal Hocko wrote:
>
> > On Wed 27-07-16 10:28:40, Mikulas Patocka wrote:
[...]
> > > I think that approach with PF_LESS_THROTTLE in mempool_alloc is incorrect
> > > and that mempool allocations should never be throttled.
> >
> > I'm not really sure this is the right approach. If a particular mempool
> > user cannot ever be throttled by the page allocator then it should
> > perform GFP_NOWAIT.
>
> Then, all block device drivers should have GFP_NOWAIT - which means that
> we can as well make it default.
>
> But GFP_NOWAIT also disables direct reclaim. We really want direct reclaim
> when allocating from mempool - we just don't want to throttle due to block
> device congestion.
>
> We could use __GFP_NORETRY as an indication that we don't want to sleep -
> or make a new flag __GFP_NO_THROTTLE.

__GFP_NORETRY is used for other contexts so it is not suitable.
__GFP_NO_THROTTLE would be possible but I would still prefer if we
didn't go that way unless really necessary.

> > Even mempool allocations shouldn't allow reclaim to
> > scan pages too quickly even when LRU lists are full of dirty pages. But
> > as I've said that would restrict the success rates even under light page
> > cache load. Throttling on the wait_iff_congested should be quite rare.
> >
> > Anyway do you see an excessive throttling with the patch posted
> > http://lkml.kernel.org/r/20160725192344.GD2166@xxxxxxxxxxxxxx ? Or from
>
> It didn't have much effect.
>
> Since the patch 4e390b2b2f34b8daaabf2df1df0cf8f798b87ddb (revert of the
> limitless mempool allocations), swapping to dm-crypt works in the simple
> example.

OK. Do you see any throttling due to wait_iff_congested?
writeback_wait_iff_congested trace point should help here. If not maybe
we should start with the above patch and see how it works in practise.
If the there is still an excessive and unexpected throttling then we
should move on to a more mempool/block layer users specific solution.
--
Michal Hocko
SUSE Labs