Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1465383pxf; Fri, 9 Apr 2021 09:04:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+29M7O5uP8Nqbic4qOy0mKKNZpoFEKv+rctqaIZ/alZJd1uJlJHO06ZQ5xAgu4iDRLyks X-Received: by 2002:a17:906:7c4:: with SMTP id m4mr17029743ejc.63.1617984244286; Fri, 09 Apr 2021 09:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617984244; cv=none; d=google.com; s=arc-20160816; b=IClzWaZmbLsnH+qx/PBrho05h3LNKJSNMJ1FEWHZMDgfjX0tagdRadpfZK5Hhlg5x3 m2tOa8AqvRiSqRErQ+QRgXT3w6t7baFE66x0Hisd5D+BBNas+eRBCiBYXN+SBb29hkPw iQsR/NMHcdQtoNmTh+mGGQg43CgP1S/MGwXrLROdoPnlscTRizu9zOHOmrth0YmbPdUA a0D923rTLXpSarYd38w0reQx1D7b5zUIeTML+7PmLQqfp+SuT6wudWmOb989uDp/EjB9 oMsjQ8Z01Ew67gb1R9qTZ2BrTfnJSDw3P/SQpMtTtdl9sK2vkB7rOSHVeW1j7AA0/qVB Siww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fZt7Dp4aLxMqBfqyIc1s7KVYsybr4288xzsHlrCh6ZE=; b=w53055ytrnha88eaY0MGPxtik1wxHVwVEh0uXALuplPp4HsOgY5TZ3+T+LbaV0OH44 jsxNSrT96idyjDudHFldDffhJ6qjrCARFzG/4d97tMNdBNZD+40KFKg+Dx/1SL+tF7SW 4ejet0Abj2GmoJl/FdCPHWrtMyAJt1bT8Hdsm3ijZ2A7sd/KVL3IcOQQctnWC/8sGemd bsCfA4ROlfbbMJUzWB9NiC0U3ifMjxUcjPnFS94BGKwl5QFL2g2CQXrhGckFXNRKZDdE jzj4u2H5CH0yiuoJjluJ1D47abhOKrtB12E0+UxUjjG0x15sggWmsHTFbBuUi7rNv/1B Hw5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=glDmhT5f; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs11si2374721ejc.375.2021.04.09.09.03.39; Fri, 09 Apr 2021 09:04:04 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=glDmhT5f; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232855AbhDIQAh (ORCPT + 99 others); Fri, 9 Apr 2021 12:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbhDIQAg (ORCPT ); Fri, 9 Apr 2021 12:00:36 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A394C061760 for ; Fri, 9 Apr 2021 09:00:23 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id f12so4539529qtf.2 for ; Fri, 09 Apr 2021 09:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fZt7Dp4aLxMqBfqyIc1s7KVYsybr4288xzsHlrCh6ZE=; b=glDmhT5fTA9NJEuSbIfNVmb9LUWolbSTkZB0wFF/OZJykSQKnfWYkfB9+qSoDgi174 p43IUTF5028C0iyow6LjJRaq94gsPd3P87yxDRr/YI71NjKQwA5NK+ct/mcBEX99s5+1 NvDo7qkHZhSeE3MMY2KAh7wDXF9HZYgL6cIuz/NvUpNc6Ew/6tHws8QTtz1Qld+kp/wc dkF8Rbvr0H0lUYq3abKyUpd1bZslps1Mw2EzZ4PXbe6/t7IxR2CpWVBp8P9qRZx3lnKc WhG7Pqevgarfu2GjUhuy6ZIv1r6FCOTVSmrnseGGNzKfvWg5NhzN4i0xMiIQUzAGPHDT B0BQ== 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; bh=fZt7Dp4aLxMqBfqyIc1s7KVYsybr4288xzsHlrCh6ZE=; b=lvMFhvnc6c73bJXfsaeMHaT0WG45f1x9ZXoBudXfSDL0MrIB2+8uFPLLkao6DRLfSa zOA11M3fO76DTYgiLBgbBidVD/MQpovn9840VtbVaESvkaKbrT8/csCsk/OW/jUS13Hl fxbNQsRVN74K2mbvYpy7H1vv7+mmGJdV31WokJfG0jH3dJgKaaS2oMIx4cO7+lExRXm0 BAt7Qpx3++y8kaSfW8AJxab0Fzo87HPE9bXJnEyuS+t9hj6Q00RtoNzrRh+pzySLSt0v ibGohPD+PGtkiaiRWGdeB52Ef5j3Mw7d3sPnn+lFfgtIU7HDqYITcayHbaGPMYmErlSY Sbaw== X-Gm-Message-State: AOAM530hQs9LU2C5i5es5u7D2PhD5q+3CZdaWJu8KRqro+J9Q9g873oS ldIrcQO41+WNrJ3l1R2s4PsvXA== X-Received: by 2002:a05:622a:42:: with SMTP id y2mr13186638qtw.173.1617984022769; Fri, 09 Apr 2021 09:00:22 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id h65sm1029491qkd.112.2021.04.09.09.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 09:00:21 -0700 (PDT) Date: Fri, 9 Apr 2021 12:00:21 -0400 From: Johannes Weiner To: Muchun Song 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 Subject: Re: [RFC PATCH v2 04/18] mm: memcontrol: simplify lruvec_holds_page_lru_lock Message-ID: References: <20210409122959.82264-1-songmuchun@bytedance.com> <20210409122959.82264-5-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210409122959.82264-5-songmuchun@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. 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.