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=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 D6B15C38A30 for ; Wed, 22 Apr 2020 06:37:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D0EF20747 for ; Wed, 22 Apr 2020 06:37:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iuvvnEZy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D0EF20747 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3A9588E0007; Wed, 22 Apr 2020 02:37:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 380AF8E0003; Wed, 22 Apr 2020 02:37:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2972C8E0007; Wed, 22 Apr 2020 02:37:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 115328E0003 for ; Wed, 22 Apr 2020 02:37:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D4563180AD81F for ; Wed, 22 Apr 2020 06:37:07 +0000 (UTC) X-FDA: 76734533694.27.team14_3e38951fb752c X-HE-Tag: team14_3e38951fb752c X-Filterd-Recvd-Size: 4499 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Apr 2020 06:37:07 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id v2so541065plp.9 for ; 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=aCtpNv5QXMo4OAL85dmW/ZarDtXIWnYIPaxtjSV2ZSIEsgkXGa6A+DxQDSFXr4yN3c 6itSccOq3mhM1d+P53GqYJ4GozFlW2F2aRk6/5iLEwQSXCeTtgUJGccVGpKQSOBFTtch EUCGSiChZ4J0bC5xTEIYA9NsPxPVDRn/hVfqvJI2W3glrw7+I/I5RkHnt+3R08iQmaH4 F56QLsrs/mIo0ei6FRuhmt8Yp88mcwnfkYaTovzT1l/Sg23DVbAFndoNzosPBblBYuzR 8osUj3XQl9YYbZdlrkE9jphmvneUy5yqGvVGiHU5k/G+VW8v/4LGF8KSefPCJsyQXFOt KB7g== X-Gm-Message-State: AGi0PuYg2kNnvW6QCgOYzT2fi7rNTw1S6kFG2IeiA0XbhbTj/Vam8Cu6 PLPMkXBxUmyLnklSeeA/Cbg= X-Google-Smtp-Source: APiQypJNXtE7bUPN3v1Q8dfxJQoVTDfXRiXQy28zJ6pB+c1zUue2V9J3jQ1XysYPJeECJnlHZSxzAA== 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) 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 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