Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1378627ybh; Mon, 13 Jul 2020 17:45:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoRjmdbY8pt+/UfwCbjHMaP6WJqPEWirGqB0ZDNYhn9rwCueboQ1wJ9cXxCxtGyQQvLJzI X-Received: by 2002:a05:6402:b86:: with SMTP id cf6mr1973284edb.42.1594687544057; Mon, 13 Jul 2020 17:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594687544; cv=none; d=google.com; s=arc-20160816; b=deJDTNUmUKDuVCa4ysnt6iHziucG/T4VlGNCghQnhlFlvYTWJBkgdijaae61s3CQow avy+y1qjgYjGTl/lOkcW3JXloWJ1JUaTXuEKgmn4AW1HcyJdJN7lek3kb0AZyzb5A107 0kmzhBHLMsvb2QutvGrXG9Sdjbj2YlXZB/XdNfTQyOwzT7fcVUVI637NZEGKhTJAg2KY BFKyCOPW+ipiilDpGalFRHIVN5JjZ5gtfbBkE0+eSOgYUiJKZ1ZN81GycM+PofRPHaLZ 176XRrr3tnAd8fmsux9eXrQtXrYcIcOet3tqJeTdGZc1Eww/mu4bzTr6VNvAkBwMedJ+ VAZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LBTyfKNSoOOAA6vthAh0GUlk56zoCc5lLvp+bO9Vv3E=; b=gchfk2ejTuOxLV4J4OCyHzHD/ORqNKnIVCbInhCMFYI4aI9Xy7kRqSKwLI6m7ZeoK2 u7dkeUAlDcdwdc40y6KEt5FVAlG/mUqWusVlWL6W09LjgASgEzlRKM4A5Q2kCfwobGYe ndKE0RB/Tjmc1wgJZmdlNP5w0I7zEdQpcd6mNKeO6D+gGvvf3ZKhkhakmX09XZpjf/9s gBZeHL3/BNVJPAGksSPqa+7E+6NGTuTABD3KIXlqWzbsaZAkEGVlV3oXmfvQbJ+E1O0w gHkKWt4skR82OljaveBezbbKE5XL0ywhYjWRUs82Jn7bq+yO202ohTm+FGXGGoFPI6kt Q6yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BhhLv7aR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv18si9694777ejb.390.2020.07.13.17.45.20; Mon, 13 Jul 2020 17:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BhhLv7aR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbgGNApH (ORCPT + 99 others); Mon, 13 Jul 2020 20:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbgGNApG (ORCPT ); Mon, 13 Jul 2020 20:45:06 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF78CC061755 for ; Mon, 13 Jul 2020 17:45:06 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id ls15so742509pjb.1 for ; Mon, 13 Jul 2020 17:45:06 -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=p0lZaJI5IcorQAZ1p3rBEwlDbHTjnfhHlUHrolGh7qhr0xAYDHvo08dUakjTSHsdTL n7KS1iFfk0jtQtgQ6113WzceQsTsYYhMlixBWQ0rnQIR6/Y2l42yqexRmHJWYjTxIRy2 s40Yw54hPo7RMLyb/9rhR2TQvpcfN0U18QLiljgvtO2AdWypiDv7dEIoRBTKFLTkSGCi OQpzQWoSNLHkFTQ2uVVAUqo+R0tU8ykHP856lo25U4blU8RCbvyoNa6DZNl3xdHYVUVi VWM+Mquhgh8IutMpktKBA1SB4+U3GJEJDQuhcFfOF+Xi5rleEX22eFGVj07y+/svtVic VxBQ== X-Gm-Message-State: AOAM533LU6Z1daoPlyyp2o8YZcsefFnTAndJ/qv0w7TIh6+zURwmpksZ wZaVcnd33yvddDG3ChLk1/Y= 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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