Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4529826ybz; Tue, 21 Apr 2020 02:14:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLaZJwzfqypNA7G+ryjirv3F1SfKVfkCZXS5TK8Oyg2zt1Qd+bjYnUzAR7C+2sq2QWIPdei X-Received: by 2002:a17:906:b28f:: with SMTP id q15mr19274071ejz.188.1587460460201; Tue, 21 Apr 2020 02:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587460460; cv=none; d=google.com; s=arc-20160816; b=oJm7SY3waq3WvsZCMzeUHUjmpAN0yVi6mnijLHOCKL3AXhecnfk4UeeMzX4beWpjeS dHHDEfmY/xhqL9p51iZki/MtRDEXLknPXfbjMqBNGuag1JFEzIyHOWpAr/ol77Bg8F9Q RueGEDeB0mpB/B7bUiJK0GEac9Ngq5a4s/gZnpbQMQda5ls2TNGxqqWZkXXC8wy2d327 J3WpbPRA4dLQYQ1k1rXVmb152T39JsuKsr7tQHFSEE8wbRSc5S2zJT3sQAZouxJDu44W bf88o3xJXdSyueJ4UayrA+nQ/ueStoJGXaQBUvXwskLtsegD41gW+me2fS/CiBm8U0dD oOQg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=FBfCCzu/7YN7VA5+5//Fv4finkZ88gxiVXGor/47u0g=; b=nFAmv4/gIaNLAfg9/4R1uQqtJn39sRmPHrqLD19pK0McIS1qmz6i90eWZygoCuwqYm ux0fOQ2v2h48BdagMzO+OfGwwkJiuQ8or6A/UiBMqYF+SnB35lMqYBmuyFfmBWCo364S 8L1SfY2p57X32sKeqbXuKQ/I7wLLVvLe1CCVeL22gkP6afsVVAqS9X+a+34LSvyO66/z yfJ8FpZLsAE+H/a5iT5EOrbeYNl+XMAl0FvEtWu9IHYbU/eGlNfD1u0AEEauAEzD3MBg Ee2ogvoFqZNmcjUNTx4a3KYWkn2eU1EuJHtBvjVGAmSIJXhc/a+6DzBn7zKmmi6w/hwT O+Ww== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si1188507edy.27.2020.04.21.02.13.57; Tue, 21 Apr 2020 02:14:20 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728131AbgDUJMV (ORCPT + 99 others); Tue, 21 Apr 2020 05:12:21 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:60719 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgDUJMV (ORCPT ); Tue, 21 Apr 2020 05:12:21 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R961e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01358;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0TwDlbOU_1587460334; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TwDlbOU_1587460334) by smtp.aliyun-inc.com(127.0.0.1); Tue, 21 Apr 2020 17:12:17 +0800 Subject: Re: [PATCH 03/18] mm: memcontrol: drop @compound parameter from memcg charging API To: Johannes Weiner , Joonsoo Kim Cc: Shakeel Butt , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200420221126.341272-4-hannes@cmpxchg.org> From: Alex Shi Message-ID: <73c1a95f-fee9-716d-c72f-85585de13f2f@linux.alibaba.com> Date: Tue, 21 Apr 2020 17:11:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200420221126.341272-4-hannes@cmpxchg.org> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/4/21 ????6:11, Johannes Weiner ะด??: > The memcg charging API carries a boolean @compound parameter that > tells whether the page we're dealing with is a hugepage. > mem_cgroup_commit_charge() has another boolean @lrucare that indicates > whether the page needs LRU locking or not while charging. The majority > of callsites know those parameters at compile time, which results in a > lot of naked "false, false" argument lists. This makes for cryptic > code and is a breeding ground for subtle mistakes. > > Thankfully, the huge page state can be inferred from the page itself > and doesn't need to be passed along. This is safe because charging > completes before the page is published and somebody may split it. > > Simplify the callsites by removing @compound, and let memcg infer the > state by using hpage_nr_pages() unconditionally. That function does > PageTransHuge() to identify huge pages, which also helpfully asserts > that nobody passes in tail pages by accident. > > The following patches will introduce a new charging API, best not to > carry over unnecessary weight. > > Signed-off-by: Johannes Weiner Reviewed-by: Alex Shi