From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8691BC54FCB for ; Wed, 22 Apr 2020 17:31:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4522A20706 for ; Wed, 22 Apr 2020 17:31:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sy64pUBY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4522A20706 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CBB578E0005; Wed, 22 Apr 2020 13:31:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6BAB8E0003; Wed, 22 Apr 2020 13:31:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B809A8E0005; Wed, 22 Apr 2020 13:31:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 9E31C8E0003 for ; Wed, 22 Apr 2020 13:31:13 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 670C4180AD81F for ; Wed, 22 Apr 2020 17:31:13 +0000 (UTC) X-FDA: 76736182026.03.rest81_61ee19c910f63 X-HE-Tag: rest81_61ee19c910f63 X-Filterd-Recvd-Size: 4177 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Apr 2020 17:31:12 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id l11so2395658lfc.5 for ; Wed, 22 Apr 2020 10:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CH/4JiFaVWzo5ZXlfDSZ+F9xWKfQK8/az3nRBT+3Ob0=; b=sy64pUBYeS1VuzngKnQzfqPdwoQ9xR/N3Sz+eeFgQarNRaojQFOFsGacyr3y3vkVyI scgMTxXkb4gRjeInhr4AoiaQ9IKFiOOktM5Ygev+YIjwJ9Mg0bxO456FvwhLwmBVMLRK YWJNZpAgZ0rSUjnJ5dyQB86w/4zGV4Qo5s9Jl3M0eN499tDFwZJ2boUBSkDqVLkFNwfs TY/yBVN42t19Bl6nsw+Q1t+McQDsP/TYTmM2DyppBmJOmkuLDEp+B3KDY1HrMTtQKpjA ugfESwMkPOqWW3PK4mKx4D8Z3PvoRRIq1M0yGb1+RvD/WPnPy27gy+n4+Cahdj5uU09N PY/Q== 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=CH/4JiFaVWzo5ZXlfDSZ+F9xWKfQK8/az3nRBT+3Ob0=; b=rEYY8lo58z8kbG96TSsZVszcGpAWgfP7rTnjxebzyaEBMJphOpaHrM7czTjlcB1JnY H2qB2SrvgVVP4hhT2br8/6L8K7Wsk3hyoGzw4aQvUI+ZvaV7XhUmgNtGcsalD9xQjJmW ZbE8Cw909e8xBo/XoeqVe26gTPFKwJ6+qp5zsaATD+VIMsvpe+fl23xhbyf8K3ugMcvu dWaXn1nhvycGSvlAugF3zlI8GhwXV1ZLeoK8ujCC4O3NvldW1VP8AuJxBIQyKPL4Ffcp jA2VAIXPY1UtFVV0Y6sV5SsatPz0f4E1x1V1Yt2Zp9EKFiwKbS7bpuYhKYrTWYCnGpuS gPiA== X-Gm-Message-State: AGi0PubPCtFrnIi+2br2fWIVgFwuyGoc9M+GgpD3a/c9m+xpvqeSX7cp 2Dom3X7HbBkYGUPauc/sGeEvs9Zk1I6QQV/gTE5LLw== X-Google-Smtp-Source: APiQypIBOdCeBOlaD4SwnrUl2Ov2dmhMv62XLptmy1XZzhZrOSgT2Am8PtZwCUE2ZTV53ujuKoxlQ4ySiX01O04rnrU= X-Received: by 2002:ac2:5e65:: with SMTP id a5mr17530208lfr.189.1587576671205; Wed, 22 Apr 2020 10:31:11 -0700 (PDT) MIME-Version: 1.0 References: <20200420221126.341272-1-hannes@cmpxchg.org> <20200420221126.341272-4-hannes@cmpxchg.org> In-Reply-To: <20200420221126.341272-4-hannes@cmpxchg.org> From: Shakeel Butt Date: Wed, 22 Apr 2020 10:30:59 -0700 Message-ID: Subject: Re: [PATCH 03/18] mm: memcontrol: drop @compound parameter from memcg charging API To: Johannes Weiner Cc: Joonsoo Kim , Alex Shi , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Apr 20, 2020 at 3:11 PM 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: Shakeel Butt