Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp988446ybt; Tue, 7 Jul 2020 05:18:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpdiHj6DAmHpRlQiNQuzLjabuWn2wx2E4UC0z0LqySjTzDfisSMDiZthYftjflHhLtoubV X-Received: by 2002:a17:906:2518:: with SMTP id i24mr1430150ejb.543.1594124323939; Tue, 07 Jul 2020 05:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594124323; cv=none; d=google.com; s=arc-20160816; b=wsGDvLxqbDyXqDXRNc7qGxt06Sj/YRQ3QKaUHQGMTT2dNqEvWWcRLsC4Alm86QKp3z MPlPxPS5KE6bWmckQ1F4JGoCZSAZKkEBRiQzmSj3o1evDFfA9k1S/0ar+9eHSYQQfmQT tALTJd8bQ1JLU6FwA8vw6d+4JwJ5XcO0kkn9GcetJ+GWAiGhOAg2G7FPgBC1DiSW8SbH h3P/Ohdq4+fSsdjml4LnWX7eBHvcIX22BqBF2779tvapmmjoIgh684E4qh/nj3rnbHKz LJZKeQzsXXmZ+zciLKSgcrNpTB6YoHZY5YxYikUD4pNvYsnvXxXYxC2f9h442ShT9W38 YqvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=akDDg9Q0FW0ymlmZdjEFsKyFHHhDnZxEK10BSm+XjZs=; b=MOatoBHMBWDtM9aJXri8B3fcO72/ZFbMQyO2jtsmqHZD45lfJ9UB2DFxUrCo5N1xSr D91/ygggNpZ2yssZAYSEictaCbd0sDB0v6AYfcyP9IC7K7D0yUVM/v/STYTBRuPABdIf Y5/rO2gaSgCrH3Q1vJLtOLfyyunHypWQ+T2HzCUsQYvAZ6yVEsaljhi+8ZvySESMsQ5/ 5jUJZuwiUtYujfbXMzLeOqw+xwVxzcU4fmcGL/LLq6u9Ya9cdjIyWcWqA2/rimQjab27 EiAgxafBQI+D53jLKEL9K3aj2uage35yl07WY24wgmhnACKET6eYpywQhNYwidPgT8nA 4k+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si13722512ejb.579.2020.07.07.05.18.20; Tue, 07 Jul 2020 05:18:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728071AbgGGMR6 (ORCPT + 99 others); Tue, 7 Jul 2020 08:17:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:42892 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbgGGMR5 (ORCPT ); Tue, 7 Jul 2020 08:17:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 69186AE65; Tue, 7 Jul 2020 12:17:56 +0000 (UTC) Subject: Re: [PATCH v4 05/11] mm/migrate: clear __GFP_RECLAIM for THP allocation for migration To: js1304@gmail.com, Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-6-git-send-email-iamjoonsoo.kim@lge.com> From: Vlastimil Babka Message-ID: Date: Tue, 7 Jul 2020 14:17:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <1594107889-32228-6-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/7/20 9:44 AM, js1304@gmail.com wrote: > From: Joonsoo Kim > > In mm/migrate.c, THP allocation for migration is called with the provided > gfp_mask | GFP_TRANSHUGE. This gfp_mask contains __GFP_RECLAIM and it > would be conflict with the intention of the GFP_TRANSHUGE. > > GFP_TRANSHUGE/GFP_TRANSHUGE_LIGHT is introduced to control the reclaim > behaviour by well defined manner since overhead of THP allocation is > quite large and the whole system could suffer from it. So, they deals > with __GFP_RECLAIM mask deliberately. If gfp_mask contains __GFP_RECLAIM > and uses gfp_mask | GFP_TRANSHUGE(_LIGHT) for THP allocation, it means > that it breaks the purpose of the GFP_TRANSHUGE(_LIGHT). > > This patch fixes this situation by clearing __GFP_RECLAIM in provided > gfp_mask. Note that there are some other THP allocations for migration > and they just uses GFP_TRANSHUGE(_LIGHT) directly. This patch would make > all THP allocation for migration consistent. > > 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 02b31fe..ecd7615 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 since GFP_TRANSHUGE is the gfp_mask > + * that chooses the reclaim masks deliberately. > + */ > + gfp_mask &= ~__GFP_RECLAIM; > gfp_mask |= GFP_TRANSHUGE; In addition to what Michal said... The mask is not passed to this function, so I would just redefine it, as is done in the hugetlb case. We probably don't even need the __GFP_RETRY_MAYFAIL for the THP case asi it's just there to prevent OOM kill (per commit 0f55685627d6d ) and the costly order of THP is enough for that. > order = HPAGE_PMD_ORDER; > } >