Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp846524pxb; Sat, 10 Apr 2021 22:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/NDf5xrNxLdog7MfNqIL7intrGr7BrOrJehBIaMuPKgrxKwSWzx5hVyEmTN/aylCxhU8Q X-Received: by 2002:a17:90b:1b42:: with SMTP id nv2mr22225453pjb.190.1618119780940; Sat, 10 Apr 2021 22:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618119780; cv=none; d=google.com; s=arc-20160816; b=ARAA251zU00NuVJ5vfJkPJrz38jERCdi5EEQBXXr3/vDUqHMEtDJn+lmJNozSPAuHz SdRvur0rI6r5Rm4gb6qMFWBYO8ce5O2Ure7K+2Zx3aIXjoYFLBKujBhKU+0lBfoxTpO9 qjmWTUGrVsvxZaIKThvgChN+QsG/QAGIu7GEkto0eRTIfN6cBJNsOtoSCBOLZTC5Ppk9 3fIjxzfCbWXiSI7DlTq1lgeMzG3mMjZND0S/iVUYRDL1jQ0x3tvEdZ64EOvnHl03Z656 nkZY+7iIaPYeax9cXbJIOAmZxZYRHemX1nqSTmcvmDDWVBZZU50TtcQiIZYrMBwa3hBQ S5YA== 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=cgAD+2Nb2JOJjFZwnbACnpjZOW/zFycvAp8/3df7DPY=; b=jrHEDOv4/H78JwCGOMTicbfWT1KMPcpIZHNpyoBRlg7F+cioIgiLuLBlwe5ZBQvv+l CzlR2W9rFHlCJ+u+uhQg26Mn/eWMwHAISLbgRL0qQXb1/Jsw5BE02n5aQf8F3Jx3pPB3 MZRd8GGQ7CQOJtkqrhHiAQYw22uaZ8JH/MnHQIjcUnIKGUzytmBI+vK2y7bwDTqqqN8b yEIUJ+6oDMmJIBq7SYredCdUY6ZHHe+g7n+LlzAjt1didI6l0eSzzdvdVcVYBljE/nbZ /d7IinURDvfSioooGf/CdV4EcUVzizoIl/69BJhP05wBuxVRs6msFF7m45mgKwmdeQ9S 5PXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=cuz0Au2Q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si8489742plc.418.2021.04.10.22.42.21; Sat, 10 Apr 2021 22:43:00 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=cuz0Au2Q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233959AbhDKFiU (ORCPT + 99 others); Sun, 11 Apr 2021 01:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbhDKFiT (ORCPT ); Sun, 11 Apr 2021 01:38:19 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F31FC06138B for ; Sat, 10 Apr 2021 22:38:03 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d8so4650716plh.11 for ; Sat, 10 Apr 2021 22:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cgAD+2Nb2JOJjFZwnbACnpjZOW/zFycvAp8/3df7DPY=; b=cuz0Au2QXG8fhErH3AfTOSYHsD+gIFbdCcOB0h574oKDLmARFTvqPTGBVpUX0IcvrQ g7wQmLffrnYVoGggC+OGhNkRcfTkm1cWqfQ6Mem5qAtMU8jBl0L5pSSW7dWKTcaI0jUd 8tNiE0m/SQU3IzslT7sYKtBHVh5zAVAJQQ8Af/ggHKKSB9WPbd9XudD+MOxbeyDo/ZET 90c+PoH/UmZVXgT3xV6fXJZmoUbyT5/C1Y2+unLAmGmk+uefwdtz7t4a5ESbDkgbx6cO I13sXTf2NIAkIRqCmhcRt+EBtnAuuNGKs8d4XUvZIFCOTBZaRkqwOesAWwx9x+T7MuUf HAWw== 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=cgAD+2Nb2JOJjFZwnbACnpjZOW/zFycvAp8/3df7DPY=; b=RCivvMbhwOncKw2hup1rqsE4SlTY2tus0uWM6YqBaHpMbm5lYGepKb7B4QcXuCxByc 5wdhOpewGqIRRdBSxhxcNsFNe2IqgUsW+R8Bw9XViy8YdDp2ZDwAmIgAQ83rDEbWZQbo BgF6+Tm+G46KqvNTlrPIk/09BREUU5WDfJI3iAV8JD/i4Z77bEJi6Y7yrgC6LCC+lY5D EdeMsGBahpsf6E3heTeokBaS9G8xusFTj5g+JzJTFENaUDLHKRQSXTlskXeXcSN2IKEE Hj7aH7giXvKy8/hTXkK7QJ/TXJ/EDO5/7nB9gNSoRpkFgG9uWDbtmTwIFck5LZfPMwmN IlLQ== X-Gm-Message-State: AOAM531sbu9b+YL9qN+4mUNRv9ejFZzpx2uYuhJO7HUiwwKjfN386fpE aXPrLtiKN4A/ngp9ERHvloGTN2sNuVsqGOQu3SzQYQ== X-Received: by 2002:a17:90a:a895:: with SMTP id h21mr12221893pjq.13.1618119483172; Sat, 10 Apr 2021 22:38:03 -0700 (PDT) MIME-Version: 1.0 References: <20210409122959.82264-1-songmuchun@bytedance.com> <20210409122959.82264-5-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Sun, 11 Apr 2021 13:37:26 +0800 Message-ID: Subject: Re: [External] Re: [RFC PATCH v2 04/18] mm: memcontrol: simplify lruvec_holds_page_lru_lock To: Johannes Weiner Cc: guro@fb.com, mhocko@kernel.org, akpm@linux-foundation.org, shakeelb@google.com, vdavydov.dev@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, bsingharora@gmail.com, shy828301@gmail.com, alex.shi@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 10, 2021 at 12:00 AM Johannes Weiner wrote: > > On Fri, Apr 09, 2021 at 08:29:45PM +0800, 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 > > Looks good to me. > > Acked-by: Johannes Weiner Thanks for your review. > > If you haven't done so yet, please make sure to explicitly test with > all three config combinations, just because the dummy abstractions for > memcg disabled or compiled out tend to be paper thin and don't always > behave the way you might expect when you do more complicated things. I have tested. There is no problem. Thanks :-) > > Something like > > boot > echo sparsefile >/dev/null (> ram size to fill memory and reclaim) > echo 1 >/proc/sys/vm/compact_memory > > should exercise this new function in a couple of important scenarios.