From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A2F5C433E2 for ; Tue, 14 Jul 2020 00:45:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F8CE21835 for ; Tue, 14 Jul 2020 00:45:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BhhLv7aR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F8CE21835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AFCD18D0002; Mon, 13 Jul 2020 20:45:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AAD1B8D0001; Mon, 13 Jul 2020 20:45:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99C478D0002; Mon, 13 Jul 2020 20:45:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 826CB8D0001 for ; Mon, 13 Jul 2020 20:45:08 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0B71C181AC9CB for ; Tue, 14 Jul 2020 00:45:08 +0000 (UTC) X-FDA: 77034837096.12.unit42_2010e6926eec Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id D4A4E1800F08E for ; Tue, 14 Jul 2020 00:45:07 +0000 (UTC) X-HE-Tag: unit42_2010e6926eec X-Filterd-Recvd-Size: 6781 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 00:45:07 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id mn17so734004pjb.4 for ; Mon, 13 Jul 2020 17:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LBTyfKNSoOOAA6vthAh0GUlk56zoCc5lLvp+bO9Vv3E=; b=BhhLv7aR3XvHyj0G9jQ/atdmxZQs2oDAmIf8x862jazgWBT0pROFNWSOzrzCPokV6u COYzMdGczxuZIbvAj0P3dkFiMDon6yIGGGjAVY4Mh91qpfKMPsyeYh3XALr28LcWp6Fd CLScefcYAWwIEPxaBorme5WcNyghNuijC0BEfDpesrvwqe/Qe1j25ixQOuHAGSNeQsbN W2dSEww9mvjeRE1qo6MVs4nUg16/49mGnzjqKeh8p3f6JC4eVpTf1n6wFvYcrRvFRBsk Dg/dr3OhH0X4AfETba4MczpQIHWhkmsQqNHZnf5k3uqZ2fxwMgTskZEGnR81arLauJfJ k3tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=LBTyfKNSoOOAA6vthAh0GUlk56zoCc5lLvp+bO9Vv3E=; b=m7RIf2r4rpA+JBHvLMGzPEN8UwnxBl++pMHczGAbLIWYXrvjo0vbRfnGnex+Hr26g5 5UVKDx5UuN5IfZsFCAJGK+2hI5X+LQgmO23aBr9RnJEhet4QFMXULYr+BGtnfR0xX4tf 2rleCAuR4l/wFkuLRln2As2ybWh23MREf9JjE5KG+5yEfylyFDTE7mmhTMiKKyXNxFYg ArkJpWqRKb5fi7BfRh40eQIrewPDl9ZaJj8UJp+fqFJ09EEWmJITfprDyRzx/2YQQ7o5 /O+fm/yNdIZ6OPXFsbd1Ocq2OqENolFvDSJFWZDENWOh+caa8xx9p+Q94RgT7vSGZyIN b+Dw== X-Gm-Message-State: AOAM5307MYCnY5zfKlaATvw5Z5zfkf5J/kvUC/cY75O32XTJ8UAN/RK0 CryQVChbbGDUUGlfJS9GlLw= X-Google-Smtp-Source: ABdhPJyqusT08COj1lT1I30BN2LIw0I5TAtC0c9JQlwzwNXf1PCndFazNtTjOMjj8N0ychbGGlddBw== X-Received: by 2002:a17:90a:ff16:: with SMTP id ce22mr2075545pjb.160.1594687506391; Mon, 13 Jul 2020 17:45:06 -0700 (PDT) Received: from js1304-desktop ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id x13sm9663755pfj.122.2020.07.13.17.45.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2020 17:45:05 -0700 (PDT) Date: Tue, 14 Jul 2020 09:44:59 +0900 From: Joonsoo Kim To: Vlastimil Babka Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko Subject: Re: [PATCH v5 4/9] mm/migrate: clear __GFP_RECLAIM to make the migration callback consistent with regular THP allocations Message-ID: <20200714004446.GA7891@js1304-desktop> References: <1594622517-20681-1-git-send-email-iamjoonsoo.kim@lge.com> <1594622517-20681-5-git-send-email-iamjoonsoo.kim@lge.com> <367ca602-1112-f87f-7d2a-b0a75cce7269@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <367ca602-1112-f87f-7d2a-b0a75cce7269@suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Queue-Id: D4A4E1800F08E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jul 13, 2020 at 09:52:20AM +0200, Vlastimil Babka wrote: > On 7/13/20 8:41 AM, js1304@gmail.com wrote: > > From: Joonsoo Kim > > > > new_page_nodemask is a migration callback and it tries to use a common > > gfp flags for the target page allocation whether it is a base page or a > > THP. The later only adds GFP_TRANSHUGE to the given mask. This results > > in the allocation being slightly more aggressive than necessary because > > the resulting gfp mask will contain also __GFP_RECLAIM_KSWAPD. THP > > allocations usually exclude this flag to reduce over eager background > > reclaim during a high THP allocation load which has been seen during > > large mmaps initialization. There is no indication that this is a > > problem for migration as well but theoretically the same might happen > > when migrating large mappings to a different node. Make the migration > > callback consistent with regular THP allocations. > > > > Signed-off-by: Joonsoo Kim > > Acked-by: Vlastimil Babka > > Thanks! > > Typo below (I assume Andrew will fix it) > > > --- > > mm/migrate.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/mm/migrate.c b/mm/migrate.c > > index 3b3d918..1cfc965 100644 > > --- a/mm/migrate.c > > +++ b/mm/migrate.c > > @@ -1547,6 +1547,11 @@ struct page *new_page_nodemask(struct page *page, > > } > > > > if (PageTransHuge(page)) { > > + /* > > + * clear __GFP_RECALIM to make the migration callback > > __GFP_RECLAIM > Okay. Here goes a fixed version. Thanks! ---------------------->8----------------------------- >From 6273f02fd8b8ef066c10c4a8ba54ea9efe6e70cd Mon Sep 17 00:00:00 2001 From: Joonsoo Kim Date: Mon, 6 Jul 2020 14:34:04 +0900 Subject: [PATCH v5 4/9] mm/migrate: clear __GFP_RECLAIM to make the migration callback consistent with regular THP allocations new_page_nodemask is a migration callback and it tries to use a common gfp flags for the target page allocation whether it is a base page or a THP. The later only adds GFP_TRANSHUGE to the given mask. This results in the allocation being slightly more aggressive than necessary because the resulting gfp mask will contain also __GFP_RECLAIM_KSWAPD. THP allocations usually exclude this flag to reduce over eager background reclaim during a high THP allocation load which has been seen during large mmaps initialization. There is no indication that this is a problem for migration as well but theoretically the same might happen when migrating large mappings to a different node. Make the migration callback consistent with regular THP allocations. Acked-by: Michal Hocko Acked-by: Vlastimil Babka Signed-off-by: Joonsoo Kim --- mm/migrate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/migrate.c b/mm/migrate.c index 3b3d918..faabb2e 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1547,6 +1547,11 @@ struct page *new_page_nodemask(struct page *page, } if (PageTransHuge(page)) { + /* + * clear __GFP_RECLAIM to make the migration callback + * consistent with regular THP allocations. + */ + gfp_mask &= ~__GFP_RECLAIM; gfp_mask |= GFP_TRANSHUGE; order = HPAGE_PMD_ORDER; } -- 2.7.4