Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3106106pxu; Mon, 14 Dec 2020 21:28:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2ccqCLgvLBnaxXLY3i6JEfrd9R3066Vcua51b6xWCZ9Vi/ng08Nq/yNciISs1eplRfoWR X-Received: by 2002:aa7:d485:: with SMTP id b5mr27048216edr.214.1608010108770; Mon, 14 Dec 2020 21:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608010108; cv=none; d=google.com; s=arc-20160816; b=stwTwbmVrwvAZ2Do9YGTa1W6RmVS7CLskyp2miW24ibpedX1AcYG96zaQKqn6GXktX oLKheKvl5xv+pEDvn37l0+zwONSdgWJgAVPjnhKoNKQPyh9GshYGZ1eE3t6OMe0HdK2o jFoB8XQc+2PT0vk57b0RBynE3Z8o0Xnb4KiyGim+Etyg/2sO0nu18gelwqf7RJj4qF+s Czv3dMj1iOHmiVneL1TtyK3UcHp2GkOvJxGFM2akUyLAr24Jp6FdTI9s0AJso+Q6mGRM T1670gsom5GDxkfy4u/aXpOJos6O5SBON2Q5lulATe+i4MrX1SALsQK7ntiiW+KtF1wG 27Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DtoFrDGyRzomOBINo4k6/LLWjzIuvMntHICBSDufujU=; b=EXMwyRlhzfK2qpOYu30DpsgKtCjcU4wfp7dHImJ0DdGYoN5wu7MAAjC/zyZPwaqTMo 2qpw74RzsJDeQ7bF8cZVasoL4TSC/QUxtRnFoH6FnsSxy2orJWUxAUr6mL9yxJepvJJw TDHcq6cTWTVv2cDaxdsbN8mUNo0jJ+VtUEEZ4aTXNGsSAwWuQD/fzCcWtiLwrXmnznii bu8j62N8UBZmRX28znO7kPFmIXSGOpnfNSzCL1FElNZJ77J7Yu+Zw/OL92nydG9tZ+Jd tATKZROYJFVIkJIC5mLyQcKE9zFuMTpoLMcrk1HQV9GHba6TT+qIu6UgPTjsRRrkOWAU N4Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=JccyEeDC; 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 p11si341000eja.213.2020.12.14.21.28.06; Mon, 14 Dec 2020 21:28:28 -0800 (PST) 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=@soleen.com header.s=google header.b=JccyEeDC; 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 S1726239AbgLOFWH (ORCPT + 99 others); Tue, 15 Dec 2020 00:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbgLOFV5 (ORCPT ); Tue, 15 Dec 2020 00:21:57 -0500 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13897C0617A7 for ; Mon, 14 Dec 2020 21:21:17 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id dk8so19662357edb.1 for ; Mon, 14 Dec 2020 21:21:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DtoFrDGyRzomOBINo4k6/LLWjzIuvMntHICBSDufujU=; b=JccyEeDCqJGvzrnf2MTHV8vENXCE6EcEbKHITxFkBO6S45+kn+osTIpTjWRM3JtZzb vPNNdbh5S1JVM6LI9b4DAi1HSURysZF24us8TaPcZPi4KFLMvmggU5+OyCQKe8XTQsAc 33BL/38GifT8ctNK9/YkhL2cd4BcyB0koGRZHwFnm8E6zJWZ2ODFlYlUqZxwvLxgedwT PJKUgrfIFKkNGGBF7KS7nYRoNQznH13b87lhRhv3fJymmBExXI74BqviWJOlMg02DfSB mqjs+rdiet8J7N3eIxlNMVG7tLXZZIZGnLNjjC7+UaB3cYlooKmKrAG1qCFKu2x4n5U+ Nwvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DtoFrDGyRzomOBINo4k6/LLWjzIuvMntHICBSDufujU=; b=Is7NUx3gW72G4LT19WhdtMtbz+4IshDsi27QbAJ8ZvLWlY0ga1UE68q61muD/a/Byj ha1QfXqD3+bmJVEVSR+SVl22SHV16zyPV1ehFlzCxXpk76MowYfoDTbGpZFZX4+Lwkxo lZe+1W2IFw7SsETCD2rhvuNqmgw8iTXimc2Dd6FDFx61gkqDT7WGvl9uYxRAmnV8VYtR fVFED8qiJ+VDPtWmZhXTYR7lvxjzsvqEH+oBvms7GTXNO66dcCg9cLfTgel0bWoWpGw8 NvklEm3334kYRBldCcm/XvxkLnj7Ho6zYuc5lslMf4cOPjcA++s8obGrI6qWiZVAtiv8 O8WQ== X-Gm-Message-State: AOAM531kqgahZGiNdRGZ9luLoW1nBPr7xkd+IpUkhgxzTl+yejHBRSYd pZb04pJoarbqyG+vPKdvw1dUIxyoZq1SNq44+AIiUg== X-Received: by 2002:a05:6402:95c:: with SMTP id h28mr853886edz.26.1608009675762; Mon, 14 Dec 2020 21:21:15 -0800 (PST) MIME-Version: 1.0 References: <20201211202140.396852-1-pasha.tatashin@soleen.com> <20201211202140.396852-4-pasha.tatashin@soleen.com> <20201214140912.GE32193@dhcp22.suse.cz> In-Reply-To: <20201214140912.GE32193@dhcp22.suse.cz> From: Pavel Tatashin Date: Tue, 15 Dec 2020 00:20:39 -0500 Message-ID: Subject: Re: [PATCH v3 3/6] mm: apply per-task gfp constraints in fast path To: Michal Hocko Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Jason Gunthorpe , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard , Linux Doc Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Ack to this. Thank you. > > But I do not really understand this. All allocation contexts should have > a proper gfp mask so why do we have to call current_gfp_context here? > In fact moving the current_gfp_context in the allocator path should have > made all this games unnecessary. Memcg reclaim path might need some > careful check because gfp mask is used more creative there but the > general reclaim paths should be ok. > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > Again, why do we need this when the gfp_mask > > }; > > -- Hi Michal, Beside from __alloc_pages_nodemask(), the current_gfp_context() is called from the following six functions: try_to_free_pages() try_to_free_mem_cgroup_pages() __node_reclaim() __need_fs_reclaim() alloc_contig_range() pcpu_alloc() As I understand, the idea is that because the allocator now honors gfp_context values for all paths, the call can be removed from some of the above functions. I think you are correct. But, at least from a quick glance, this is not obvious, and is not the case for all of the above functions. For example: alloc_contig_range() __alloc_contig_migrate_range isolate_migratepages_range isolate_migratepages_block /* * Only allow to migrate anonymous pages in GFP_NOFS context * because those do not depend on fs locks. */ if (!(cc->gfp_mask & __GFP_FS) && page_mapping(page)) goto isolate_fail; If we remove current_gfp_context() from alloc_contig_range(), the cc->gfp_mask will not be updated with proper __GFP_FS flag. I have studied some other paths, and they are also convoluted. Therefore, I am worried about performing this optimization in this series.