From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH 4/9] mm: introduce memalloc_nofs_{save,restore} API
Date: Sun, 18 Dec 2016 17:21:59 +0100 [thread overview]
Message-ID: <20161218162159.GB8440@dhcp22.suse.cz> (raw)
In-Reply-To: <7019c051-ebca-7396-54f9-2a1d5805c57b@I-love.SAKURA.ne.jp>
On Sat 17-12-16 19:44:22, Tetsuo Handa wrote:
> On 2016/12/15 23:07, Michal Hocko wrote:
> > GFP_NOFS context is used for the following 5 reasons currently
> > - to prevent from deadlocks when the lock held by the allocation
> > context would be needed during the memory reclaim
> > - to prevent from stack overflows during the reclaim because
> > the allocation is performed from a deep context already
> > - to prevent lockups when the allocation context depends on
> > other reclaimers to make a forward progress indirectly
> > - just in case because this would be safe from the fs POV
> > - silence lockdep false positives
> >
> > Unfortunately overuse of this allocation context brings some problems
> > to the MM. Memory reclaim is much weaker (especially during heavy FS
> > metadata workloads), OOM killer cannot be invoked because the MM layer
> > doesn't have enough information about how much memory is freeable by the
> > FS layer.
>
> This series is intended for simply applying "& ~__GFP_FS" mask to allocations
> which are using GFP_KERNEL by error for the current thread, isn't it?
Not really. I've tried to cover that in changelogs but in short I would
like to achieve a state where this api would cover all the recursion
dangerous places with a documentation why and most/all the specific
allocations will not care about NOFS at all. They will simply inherit
NOFS scope when necessary.
> > In many cases it is far from clear why the weaker context is even used
> > and so it might be used unnecessarily. We would like to get rid of
> > those as much as possible. One way to do that is to use the flag in
> > scopes rather than isolated cases. Such a scope is declared when really
> > necessary, tracked per task and all the allocation requests from within
> > the context will simply inherit the GFP_NOFS semantic.
> >
> > Not only this is easier to understand and maintain because there are
> > much less problematic contexts than specific allocation requests, this
> > also helps code paths where FS layer interacts with other layers (e.g.
> > crypto, security modules, MM etc...) and there is no easy way to convey
> > the allocation context between the layers.
>
> I haven't heard an answer to "a terrible thing" in
> http://lkml.kernel.org/r/20160427200530.GB22544@dhcp22.suse.cz .
>
> What is your plan for checking whether we need to propagate "& ~__GFP_FS"
> mask to other threads which current thread waits synchronously (e.g.
> wait_for_completion()) from "& ~__GFP_FS" context?
This needs a deeper inspection. First of all we have to find out whether
we have a _relevant_ code which depends on kworkers (without WQ_MEM_RECLAIM)
from the NOFS context. This is not covered in this patch series, though.
I plan to get to it later after we actually finish this step.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-12-18 16:22 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 14:07 [PATCH 0/9 v2] scope GFP_NOFS api Michal Hocko
2016-12-15 14:07 ` [PATCH 1/9] lockdep: allow to disable reclaim lockup detection Michal Hocko
2016-12-15 14:07 ` [PATCH 2/9] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives Michal Hocko
2016-12-16 15:40 ` [PATCH 2/9 v2] " Michal Hocko
2016-12-16 16:37 ` Brian Foster
2016-12-16 22:01 ` Michal Hocko
2016-12-19 21:24 ` [PATCH 2/9] " Dave Chinner
2016-12-19 22:06 ` Darrick J. Wong
2016-12-20 21:39 ` Dave Chinner
2016-12-20 8:38 ` Michal Hocko
2016-12-15 14:07 ` [PATCH 3/9] xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS Michal Hocko
2016-12-16 16:38 ` Brian Foster
2016-12-15 14:07 ` [PATCH 4/9] mm: introduce memalloc_nofs_{save,restore} API Michal Hocko
2016-12-17 10:44 ` Tetsuo Handa
2016-12-18 16:21 ` Michal Hocko [this message]
2016-12-15 14:07 ` [PATCH 5/9] xfs: use memalloc_nofs_{save,restore} instead of memalloc_noio* Michal Hocko
2016-12-16 16:38 ` Brian Foster
2016-12-16 22:00 ` [PATCH 5/9 v2] " Michal Hocko
2016-12-15 14:07 ` [PATCH 6/9] jbd2: mark the transaction context with the scope GFP_NOFS context Michal Hocko
2016-12-16 8:39 ` Jan Kara
2016-12-15 14:07 ` [PATCH 7/9] jbd2: make the whole kjournald2 kthread NOFS safe Michal Hocko
2016-12-16 8:40 ` Jan Kara
2016-12-15 14:07 ` [PATCH 8/9] Revert "ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp" Michal Hocko
2016-12-16 8:41 ` Jan Kara
2016-12-15 14:07 ` [PATCH 9/9] Revert "ext4: fix wrong gfp type under transaction" Michal Hocko
2016-12-16 8:43 ` Jan Kara
2016-12-16 12:46 ` [DEBUG PATCH 0/2] debug explicit GFP_NO{FS,IO} usage from the scope context Michal Hocko
2016-12-16 12:46 ` [DEBUG PATCH 1/2] mm, debug: report when GFP_NO{FS,IO} is used explicitly from memalloc_no{fs,io}_{save,restore} context Michal Hocko
2016-12-16 12:46 ` [DEBUG PATCH 2/2] silent warnings which we cannot do anything about Michal Hocko
2016-12-16 15:05 ` [PATCH 0/9 v2] scope GFP_NOFS api Mike Galbraith
2016-12-16 15:35 ` Michal Hocko
2016-12-16 16:27 ` Mike Galbraith
2016-12-19 9:25 ` Jan Kara
2016-12-22 9:38 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161218162159.GB8440@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox