Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp937084ybz; Wed, 22 Apr 2020 10:32:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLBNDuFZKM45cVTGyZ3IPkTQIIHAaoEkK9W5h4a32AqYbludklX/i+bCuq0htHj/01FFC/g X-Received: by 2002:aa7:d0c2:: with SMTP id u2mr9868741edo.78.1587576771482; Wed, 22 Apr 2020 10:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587576771; cv=none; d=google.com; s=arc-20160816; b=gJMfSlO7Y1BPrlAD9sW+91tHYJBIJdLKyWXDe83UQsWgDOhcIypRcGQgyA2viFMyyJ ws8mUB9Zls7GFGUe/t0V7eeBIRwmNSyVRvmOGlrpy9LXGVFq+NxVaQGIlvB5hEsmX7ct 8ym9Ch3ZezWwysiCsCuCrrAgDQS/sqOEF4iowY26Son8HCrzP176Am0O3OUqsrLpq8Vz VF8OnZP/B4n2VIauC6G84ZaNGY+pO+CjFltamqmiuSGBDGc8nE0Esv7yn5d58aJT9L13 NFogVdXo9DHTq0xvS5E6ruahEdWSZJIAEr/j8TMGN+oqrwt3GgennT/4N867qcMQVBRC GvHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=CH/4JiFaVWzo5ZXlfDSZ+F9xWKfQK8/az3nRBT+3Ob0=; b=iA96RhELaBc8MXm9W6Gov9mSzA0GN/94Hi/+wfrspeiWLUMxiGr//cKU/cCxk4mFWR VUTSZl7HJAXyRfXuL9UBzBiGJ9L34rSXoS8IcdOkUZ/dlPR94fYplt/RpNUstJyXPBbZ ki6e92Cl686OAesPFL4t0JbgKfPkHATY7U56mrWXrFlXlhqxJYp5ESx9i3le7QYngHS9 tcg708J0aZpa68cVSgpcGnoDZl7VDJ332vZEyIzJ4lwD6zLg/HCOUOPjqrlWlze2X1KY tRU9IM/2/Rm0gNoXYVEDqrSSnhqTvOjsTLuRUyDe74lUyxcS22tPYuwsFkI96CkW8k2p qz2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sy64pUBY; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si3983489ejh.256.2020.04.22.10.32.25; Wed, 22 Apr 2020 10:32:51 -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=@google.com header.s=20161025 header.b=sy64pUBY; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbgDVRbO (ORCPT + 99 others); Wed, 22 Apr 2020 13:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726006AbgDVRbN (ORCPT ); Wed, 22 Apr 2020 13:31:13 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02641C03C1A9 for ; Wed, 22 Apr 2020 10:31:13 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id j14so2378235lfg.9 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=cJrTOpK4HPQHu4TJZDA2RnoHHDHC9hzC+5bxo4WGdAM+zFeL6AQNq/ByTFQ/r2e8dj 7FIakWVNM7XRNtQE/YInPabHf4ROqtM1pDNP6smqBrXIrtNPL7nTEfRDD+eRWS5854AY YVYKYYl4gRYNsoprRl5GpgLvDxkUIlI10QdZ79BTkYiP/zNsSS00AXP0fKLUV+fbhSDF UqrqCu9zG55yd65Z2D7j4nes9+wY7KEqfoJs2WOrp5rZqmkNZNwyqrR2xrLa3kVcei7/ UVJznbz0AmoOExLHkuqalVyvjyZZmonFBUONigDYvESotrLVstC0bI/8sKp2t/EXAmrI /I9g== X-Gm-Message-State: AGi0PuYY8SdQek9V1TuBRICgm136TccENfEBauQeAkXLByYFov+jvL3R 5XjBS2lQTqoVtPr+6QJuDshO503NqAogHeKevb2dLw== 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" 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 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