Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp66727ybv; Wed, 12 Feb 2020 19:19:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzfZ3v4cM0aoP0C5aGZHditF2i+UFUN5PCCQ04u9cDnvFGC1DPD5nUkaBW80ToSYxyxEUZi X-Received: by 2002:a05:6830:20c4:: with SMTP id z4mr12335983otq.260.1581563994424; Wed, 12 Feb 2020 19:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581563994; cv=none; d=google.com; s=arc-20160816; b=LhJHN2LgGHRc9HYB6zG28pdj6UdXQQr7Fzf/iES4GWqLMbPxDNfqjosW9P+TpF5ttZ zGR7846vQLAbfCQOryR07in2/uxvRfZw7BQFexHZCQXHs+7qq71gxEBXo9bZQi28R4u9 eqxEaLEyhT8VniQpgBvnKXw3sUmcOxvqCocTq7pBDb6JQlCzEQijkDUJDGN4xeem/lx5 +LtKKVMPepdnywRt+QhJerXVqY07DmAhZ/00peS2keo4YQr8PsJ4Zwa0SF9DKnyggmrY pZx7dIsnzbhA6ehfArX79/79Z2YQjbDbSxu45/tyZQ2RI9n4o70pYj7n2uzmAnnYY/i/ B2Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=1VVgsqnMIsNESVVGRNBaCV+aan4mbp3gjKJscoBqFYU=; b=TpckHPzBo74sDvuUYzCtmjRS0HegRoG9PBVslMWgHyon4Grl/kBO4wFVOygBNeT08f Bg4o9+xhk9XiAkumZL9EZyeBu/XYMGwwaZrzsg+izIvKRzw7aPgJFyn9E9h/9uwp30ES CJPRP0aYCrjRlEIDMs3JCNWDIVSAb7Or/AJnXAnFZ9jbXbP61uQau7vGk0rH+TnEECIA tyfJs74WsxMMKJ7w2tvEOB+R3XkLuMT+HmbW67IO1sZWw7wSAcZqiFgU9jSFN2PJZVgm xdrYtR45O/rD8Ok0G5iVdkCz1yuCXkiHeBjfiztfob8j5XkgUAKzRqyrJmTrZ34gLD8l h3FA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si597690oif.14.2020.02.12.19.19.40; Wed, 12 Feb 2020 19:19:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729467AbgBMDTE (ORCPT + 99 others); Wed, 12 Feb 2020 22:19:04 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:54284 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729404AbgBMDTE (ORCPT ); Wed, 12 Feb 2020 22:19:04 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R491e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04391;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0TprKK6x_1581563940; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TprKK6x_1581563940) by smtp.aliyun-inc.com(127.0.0.1); Thu, 13 Feb 2020 11:19:02 +0800 Subject: Re: [PATCH 2/2] mm: vmpressure: use mem_cgroup_is_root API To: Michal Hocko Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1581398649-125989-1-git-send-email-yang.shi@linux.alibaba.com> <1581398649-125989-2-git-send-email-yang.shi@linux.alibaba.com> <20200212082346.GB11353@dhcp22.suse.cz> From: Yang Shi Message-ID: <94323469-c9d5-33ab-318b-2677dd966a92@linux.alibaba.com> Date: Wed, 12 Feb 2020 19:18:59 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200212082346.GB11353@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/20 12:23 AM, Michal Hocko wrote: > On Tue 11-02-20 13:24:09, Yang Shi wrote: >> Use mem_cgroup_is_root() API to check if memcg is root memcg instead of >> open coding. > Yes, the direct use outside of memcontrol.c should be really an > exception. The only other similar case is cgwb_bdi_init and there is no > easy way to replace - except for adding a helper which is not worth it. Yes, it seems so. cgwb_bdi_init just deferences root_mem_cgroup to access its css. It is the only user outside memcontrol.c, so I agree a helper for it might be overkilling. Once we have more users, it should be considered. > >> Signed-off-by: Yang Shi > Acked-by: Michal Hocko Thanks. > > Thanks! > >> --- >> mm/vmpressure.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/vmpressure.c b/mm/vmpressure.c >> index 0590f00..d69019f 100644 >> --- a/mm/vmpressure.c >> +++ b/mm/vmpressure.c >> @@ -280,7 +280,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree, >> enum vmpressure_levels level; >> >> /* For now, no users for root-level efficiency */ >> - if (!memcg || memcg == root_mem_cgroup) >> + if (!memcg || mem_cgroup_is_root(memcg)) >> return; >> >> spin_lock(&vmpr->sr_lock); >> -- >> 1.8.3.1 >>