Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp386796ybz; Tue, 21 Apr 2020 23:41:07 -0700 (PDT) X-Google-Smtp-Source: APiQypLmqZzjef0AZ4SE219NkCeSUY5IPoNe0rEyjgBqhZVCK2JIQ3ympQrV6SDSYjsc9wWY8ZMQ X-Received: by 2002:a05:6402:204b:: with SMTP id bc11mr21557710edb.114.1587537666932; Tue, 21 Apr 2020 23:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587537666; cv=none; d=google.com; s=arc-20160816; b=sgAZ04cCi0/b3YHNG61OwjbMLbZQ0E0ytYs140WMwJ54l+OUdl++2ZsJg+jUHS2Dpv 4DcdKI9Zk28vT5LgpQtAcHnVGcF9eVUws+fMBU2X/nwU0HrDUOhXZXlLxtzaa4TkHMS6 EPitSyMEddLtVGbHWIeL1WJ+zzuQLuHAgmb2PBSefsT36XJQ83C0/jN73V38XqcM+9Mc etlGTEvSNzh7Z/fVkiP5GJEhyqKfggFu1XIF3LdHya+2/3L4E1dJBe3e6h2VPIkyYXkx CjKdrAbdza8nbtaLffJgx2CSstQiDP5194LHTr7EX6lq5LZ0s8ZWwGe596SVXuHGnNhT XYyQ== 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=5sPywIAZDU2flYyDIq+uLr1t/vlUGNE5qQ6q2icgX/U=; b=o/wXcSEasX+6lhA6Tx4ahvrH0ehmnZx5JN2Qu6eCgFmbTv6IuJ8k05Qs1TZI9OHsPV KZ2rc/sSkmnGMccVJNSFuSF31RqJGHXj8mnetjOVTt3vFg0DZ2nBX9rmK5EjxM0A11JI qkOCUZNyzzKbKlt1fWhA4Y46D7afoFyrUdlIHUU6EFbmsQOR/Isgk3DX6viLrLxdHNqr gO/nbKKHvSfiZWY3gam0H79THMeoVS8T7YkGSqkTd8bJZjbOESLQsr+Qd597KY1zBz3L vskiRkBMljyOBfOdyRDPKC930uH+vJH3wbUy2cvX2Pu2QK0AKahNQISV1G2jdidD3hqx TsAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iuvvnEZy; 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 j9si2066046edn.415.2020.04.21.23.40.43; Tue, 21 Apr 2020 23:41:06 -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=iuvvnEZy; 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 S1726465AbgDVGhH (ORCPT + 99 others); Wed, 22 Apr 2020 02:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbgDVGhH (ORCPT ); Wed, 22 Apr 2020 02:37:07 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18824C03C1A6; Tue, 21 Apr 2020 23:37:07 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id g2so555379plo.3; Tue, 21 Apr 2020 23:37:07 -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=5sPywIAZDU2flYyDIq+uLr1t/vlUGNE5qQ6q2icgX/U=; b=iuvvnEZydRgcq1Z4TUJreYmlRt+sDrNv+6pNyoY30/hH0jp9bzYa4PgigR0HeZigW/ UeUbY4E+IqKrpvjloRy8LUuBHCH0mo5ESeOr1ieFkeMods47eHkBBwA3ZZ5cGFQgjJnW mfaw0JE185YwVfJ/9AOZQDjc69yc8QcivrulSEbX4VKZKUyS/aVx2FQKOgfERe7SqKoI /xTBhLF92vinPrne/b96oDFEbEx8S/kA7U86CV/5GjXMVsYn1gs9LR7SFEhPxJr5QGAb PEJwNERbqxn4DZM7azcgmaOFn+S03cJb9L+KVrjYxeMVI4pPkk5ogMeU/NNkvICMN4cD 6KAg== 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=5sPywIAZDU2flYyDIq+uLr1t/vlUGNE5qQ6q2icgX/U=; b=DRP6wqn0a843/oyVgQcWnG9IpTy3PFsTCFVOZylxeuPN1iHQfE5czp0nZrrWjfbzJJ clbaIJKPATwHVsFCEVdtMoTppvWcSzivDCq1NaoKcCHOirce85lA8KOeeHn5CXREaVPk Gmh+OwygR9jJx8Nh65t4+lf5LMH2n00Tgmi1W8nVZfdEVHZhipD2UyiIbtfai9Zq5Uhc xFoVIEJSWOBPXg+3kZbuHKWKfaDyr94mlpUt80GT84Dewvx9kuG0/yR1WGkeGqXQ1zj2 bgh8P4eS0Knzn7CMS4mEViC6/kXXuoWQTouyygCDmXk0PQ84kd+4WIqiTk7T5nSVLbxj npuA== X-Gm-Message-State: AGi0PubxLzpkX8KkusWPyg0RyBFYmEAdBgz5shf7OROFaP+fO9704rG5 IHZ3jLTqdLidikNRc0gGKX0= X-Received: by 2002:a17:902:a513:: with SMTP id s19mr25897949plq.84.1587537426575; Tue, 21 Apr 2020 23:37:06 -0700 (PDT) Received: from js1304-desktop ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id r10sm4144366pgh.23.2020.04.21.23.37.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2020 23:37:06 -0700 (PDT) Date: Wed, 22 Apr 2020 15:37:00 +0900 From: Joonsoo Kim To: Johannes Weiner Cc: Alex Shi , 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 Subject: Re: [PATCH 03/18] mm: memcontrol: drop @compound parameter from memcg charging API Message-ID: <20200422063659.GC6780@js1304-desktop> References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200420221126.341272-4-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200420221126.341272-4-hannes@cmpxchg.org> 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, Apr 20, 2020 at 06:11:11PM -0400, Johannes Weiner wrote: > 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: Joonsoo Kim