Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2712612pxb; Tue, 13 Apr 2021 08:26:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy303c86U1+/eCIg2I0t2E5aH459fEbd5Df9fWLo0x26ZovXaS/RPSAbsKenTg7v3eP4YYW X-Received: by 2002:a17:906:4cc5:: with SMTP id q5mr23668165ejt.302.1618327575207; Tue, 13 Apr 2021 08:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618327575; cv=none; d=google.com; s=arc-20160816; b=BfZMk3x3JMmQn9j8lPH9dBcGSkOlsWuMmaYPrXCsFwhhcYJLZ4Tp0Rn11eLqFAduGT KYHizUDbhT9aekXwS9H0IgfI3Uvw9nuZbymJavWc3P5s7/yo2R9M4BRr17zgfNFSjUIr 1k9qteI9Duy1aGrUO5RKY6VRdHvU3d9p0rC5T9tSkFDYa2YCtTLvCk39cvkXD2wrukrl ww5eqL+LeWXuYprPTGwtk1IcUzjLio54AkLe6iFDw2RqpeEH3yRuo37xUzfsO3b/YJoP QrnOXF7cKs3koqlz4hg2JTK93dA3FBwGm3BKLiMFF3V8hPASoZ3aCiTFw5PLIxU/E1rP 4MHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Hj/SeZ1ZvvwY1xIzJooNaPGvpH3onFVxBgFQtfF6dKs=; b=uHdZNliEGg+ElhFbHImU9rJiLhS4gRPsZfOR8Cak4jtI8tO1jhQEkdtQTwqSiN8Dzk VhvsgsHbuIyGKV4prO5oSPiZ50rXUEVskKLV9KJounG/3EwZgPzPmnus9gDP/vtVSt1d HC3Mx2QF+Tj5PliGAjzvob9Dpq+kXBAqWpuuvBnlSAsU9nUvoE/5ycaHQiPTZDoMX1gF 4LK0shs18YBjA+/xw4tC3g69vM/8vWe+lVRBUUBocHDZ/K1/0Xj7k5pA+ib747QoYaqO tOpv2Zi8LsmKWmZwPlUmQraihnsxeiW0yflyAtwaXPb/ij6dOs+/t4G/au+dFATgr6IA s5Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b5uJDNpP; 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 r5si9872648edw.488.2021.04.13.08.25.51; Tue, 13 Apr 2021 08:26:15 -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=b5uJDNpP; 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 S1345993AbhDMN25 (ORCPT + 99 others); Tue, 13 Apr 2021 09:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242158AbhDMN2n (ORCPT ); Tue, 13 Apr 2021 09:28:43 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D977C061574 for ; Tue, 13 Apr 2021 06:28:23 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id r22so8629281ljc.5 for ; Tue, 13 Apr 2021 06:28:23 -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=Hj/SeZ1ZvvwY1xIzJooNaPGvpH3onFVxBgFQtfF6dKs=; b=b5uJDNpPZbifglYYEysAar2xQtFPzsraSWEM4TDaO+4wZXQiLchll2ftbQN4OaTVoS CVOXKoqUpICrWyhMIeJQya5LKJmA/im+tlRBCtBLgSpBDTOmaYCcdwHrRbkl7mBZPYxC AbSC7cZNjgfZQlIfdWAtWvymvtrpX+ZiYbkydyhtR4XY93fFeV3l7KaCzG7PhLC/gMnA dX83Q0DNRfUXDQTaISGbVrG5H2kP5Gr+VuUHY4sBpxld5+SzquxYs87K/xFh7kJFdjQf sx0z7JLZkJbHa/DG2l7xo/dAznjYkEsrwivW16Dhhng4JSWR3rqpax9U7TP90BaGmAIc HDVQ== 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=Hj/SeZ1ZvvwY1xIzJooNaPGvpH3onFVxBgFQtfF6dKs=; b=DtUgWepKlIOhWomu4dYC/UFmFS3B6UziFWrq1twOf4Flk+feU0vRRUQGyOtXF62CV3 9uwtoVIM7NAucBd47vue1HgEoeKoB2iX+V1vr1y6UoH/2lDro2zDsiQX2G5P91iXdrfR 7OhBuQyp+vnepcSfEKomxfXz9iTNKZGVDyRuAnpnygEzz04F4U4w8DepZ1PX1DyOuldR eWWgjHNV1zh7LliFU27DZf3mis8t9GPwalhrnTSfEqxQstgfc8krJeXK43TLI8aRsDc6 Jd9Ue3LnkPUq6M3GMm9aJK3b+czDqumRG0JdMWG0dTJSSyg5YVB9iH1ANV+tjE7Vbtjw B9eg== X-Gm-Message-State: AOAM533reXChNPrVg76rC9TrYVfqw8lW8jI3cX60f78z/mMcUbpyuUQx Qeksb1YTb0ZnY2SUa3+s75eQ4bG2z8R/Wr2AFBGjOQ== X-Received: by 2002:a2e:8084:: with SMTP id i4mr21632742ljg.122.1618320501679; Tue, 13 Apr 2021 06:28:21 -0700 (PDT) MIME-Version: 1.0 References: <20210413065153.63431-1-songmuchun@bytedance.com> <20210413065153.63431-5-songmuchun@bytedance.com> In-Reply-To: <20210413065153.63431-5-songmuchun@bytedance.com> From: Shakeel Butt Date: Tue, 13 Apr 2021 06:28:09 -0700 Message-ID: Subject: Re: [PATCH 4/7] mm: memcontrol: simplify lruvec_holds_page_lru_lock To: Muchun Song Cc: Roman Gushchin , Johannes Weiner , Michal Hocko , Andrew Morton , Vladimir Davydov , LKML , Linux MM , Xiongchun duan , fam.zheng@bytedance.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 11:57 PM Muchun Song wrote: > > We already have a helper lruvec_memcg() to get the memcg from lruvec, we > do not need to do it ourselves in the lruvec_holds_page_lru_lock(). So use > lruvec_memcg() instead. And if mem_cgroup_disabled() returns false, the > page_memcg(page) (the LRU pages) cannot be NULL. So remove the odd logic > of "memcg = page_memcg(page) ? : root_mem_cgroup". And use lruvec_pgdat > to simplify the code. We can have a single definition for this function > that works for !CONFIG_MEMCG, CONFIG_MEMCG + mem_cgroup_disabled() and > CONFIG_MEMCG. > > Signed-off-by: Muchun Song > Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt