From: Michal Hocko <mhocko@kernel.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/8] mm: introduce memalloc_nofs_{save, restore} API
Date: Mon, 9 Jan 2017 14:59:01 +0100 [thread overview]
Message-ID: <20170109135901.GJ7495@dhcp22.suse.cz> (raw)
In-Reply-To: <20170109134210.GI7495@dhcp22.suse.cz>
On Mon 09-01-17 14:42:10, Michal Hocko wrote:
> On Mon 09-01-17 14:04:21, Vlastimil Babka wrote:
[...]
> Now that you have opened this I have noticed that the code is wrong
> here because GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK would overwrite
> the removed GFP_FS.
Blee, it wouldn't because ~GFP_RECLAIM_MASK will not contain neither
GFP_FS nor GFP_IO. So all is good here.
> I guess it would be better and less error prone
> to move the current_gfp_context part into the direct reclaim entry -
> do_try_to_free_pages - and put the comment like this
well, after more thinking about we, should probably keep it where it is.
If for nothing else try_to_free_mem_cgroup_pages has a tracepoint which
prints the gfp mask so we should use the filtered one. So let's just
scratch this follow up fix.
> ---
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 4ea6b610f20e..df7975185f11 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2756,6 +2756,13 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
> int initial_priority = sc->priority;
> unsigned long total_scanned = 0;
> unsigned long writeback_threshold;
> +
> + /*
> + * Make sure that the gfp context properly handles scope gfp mask.
> + * This might weaken the reclaim context (e.g. make it GFP_NOFS or
> + * GFP_NOIO).
> + */
> + sc->gfp_mask = current_gfp_context(sc->gfp_mask);
> retry:
> delayacct_freepages_start();
>
> @@ -2949,7 +2956,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> unsigned long nr_reclaimed;
> struct scan_control sc = {
> .nr_to_reclaim = SWAP_CLUSTER_MAX,
> - .gfp_mask = (gfp_mask = current_gfp_context(gfp_mask)),
> + .gfp_mask = gfp_mask,
> .reclaim_idx = gfp_zone(gfp_mask),
> .order = order,
> .nodemask = nodemask,
> @@ -3029,8 +3036,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
> int nid;
> struct scan_control sc = {
> .nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
> - .gfp_mask = (current_gfp_context(gfp_mask) & GFP_RECLAIM_MASK) |
> - (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK),
> + .gfp_mask = GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK,
> .reclaim_idx = MAX_NR_ZONES - 1,
> .target_mem_cgroup = memcg,
> .priority = DEF_PRIORITY,
> @@ -3723,7 +3729,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
> int classzone_idx = gfp_zone(gfp_mask);
> struct scan_control sc = {
> .nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
> - .gfp_mask = (gfp_mask = current_gfp_context(gfp_mask)),
> + .gfp_mask = gfp_mask,
> .order = order,
> .priority = NODE_RECLAIM_PRIORITY,
> .may_writepage = !!(node_reclaim_mode & RECLAIM_WRITE),
> --
> Michal Hocko
> SUSE Labs
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2017-01-09 13:59 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 14:10 [Cluster-devel] [PATCH 0/8 v3] scope GFP_NOFS api Michal Hocko
2017-01-06 14:11 ` [Cluster-devel] [PATCH 1/8] lockdep: allow to disable reclaim lockup detection Michal Hocko
2017-01-09 12:56 ` Vlastimil Babka
2017-01-06 14:11 ` [Cluster-devel] [PATCH 2/8] xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS Michal Hocko
2017-01-09 12:59 ` Vlastimil Babka
2017-01-09 14:29 ` Michal Hocko
2017-01-09 20:58 ` Darrick J. Wong
2017-01-06 14:11 ` [Cluster-devel] [PATCH 3/8] mm: introduce memalloc_nofs_{save, restore} API Michal Hocko
2017-01-09 13:04 ` Vlastimil Babka
2017-01-09 13:42 ` Michal Hocko
2017-01-09 13:59 ` Michal Hocko [this message]
2017-01-09 14:04 ` Vlastimil Babka
2017-01-06 14:11 ` [Cluster-devel] [PATCH 4/8] xfs: use memalloc_nofs_{save, restore} instead of memalloc_noio* Michal Hocko
2017-01-09 14:08 ` Vlastimil Babka
2017-01-09 14:25 ` Michal Hocko
2017-01-09 15:56 ` Brian Foster
2017-01-09 20:59 ` Darrick J. Wong
2017-01-06 14:11 ` [Cluster-devel] [PATCH 5/8] jbd2: mark the transaction context with the scope GFP_NOFS context Michal Hocko
2017-01-06 14:11 ` [Cluster-devel] [PATCH 6/8] jbd2: make the whole kjournald2 kthread NOFS safe Michal Hocko
2017-01-06 14:11 ` [Cluster-devel] [PATCH 7/8] Revert "ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp" Michal Hocko
2017-01-17 3:01 ` Theodore Ts'o
2017-01-17 7:54 ` Michal Hocko
2017-03-06 11:59 ` Michal Hocko
2017-01-06 14:11 ` [Cluster-devel] [PATCH 8/8] Revert "ext4: fix wrong gfp type under transaction" Michal Hocko
2017-01-17 2:56 ` Theodore Ts'o
2017-01-17 8:24 ` Michal Hocko
2017-01-17 15:18 ` Michal Hocko
2017-01-17 15:59 ` Theodore Ts'o
2017-01-17 16:16 ` Michal Hocko
2017-01-17 17:29 ` Jan Kara
2017-01-19 8:39 ` Michal Hocko
2017-01-19 9:22 ` Jan Kara
2017-01-19 9:44 ` Michal Hocko
2017-01-26 7:44 ` Michal Hocko
2017-01-27 6:13 ` Theodore Ts'o
2017-01-27 9:37 ` Michal Hocko
2017-01-27 16:40 ` Theodore Ts'o
2017-01-28 7:32 ` Christoph Hellwig
2017-01-28 8:17 ` David Lang
2017-01-30 8:12 ` Michal Hocko
2017-02-03 15:32 ` Michal Hocko
2017-01-17 21:04 ` Andreas Dilger
2017-01-18 8:29 ` Michal Hocko
2017-01-06 14:18 ` [Cluster-devel] [DEBUG PATCH 0/2] debug explicit GFP_NO{FS, IO} usage from the scope context Michal Hocko
2017-01-06 14:18 ` [Cluster-devel] [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
2017-01-06 14:18 ` [Cluster-devel] [DEBUG PATCH 2/2] silent warnings which we cannot do anything about 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=20170109135901.GJ7495@dhcp22.suse.cz \
--to=mhocko@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).