From patchwork Mon May 22 11:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "T.J. Alumbaugh" X-Patchwork-Id: 97321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1376586vqo; Mon, 22 May 2023 04:33:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dx2V6H9XICoKF6uGaEXMCo+RRFZWE/0XcjRj48QR7FCdU6DCKE0PNhKiBMcIDryWynPU7 X-Received: by 2002:a05:6a00:2d90:b0:64d:2487:5b3c with SMTP id fb16-20020a056a002d9000b0064d24875b3cmr13658637pfb.29.1684755231782; Mon, 22 May 2023 04:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684755231; cv=none; d=google.com; s=arc-20160816; b=VYW3hekqjIQ1EBZRS3P1n80NtvJ+x2Hd5suZi7ML2DeAeElYxY0O8DI2jlzSYIUJL/ YWosUROE9PSgHrANt0RF7VUnD9zdVoRswbE+ExLXs0sZPMwQCDtj2MXmwD9/wo2mY6yX Um+sJTY6Oeoqylv8d9MLWGcwc8q2uVi31Zfp/6kH7Hgpn90N6MagvtDHBHXdklkR3QVz Eaones9wM+07943KmS6+BNy5H7bvYV/Jy+9sV6KmmU1ponaI7MtOLu3xfvudhTRzZLWQ IBqofk9fofEUKfhIKuLlCgbNjuMDwfB3dxIGegyVLVH/6UigBkEN3mNvKNXw868MQ5oU RxqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=o+eiSCYBIOLnXleM2cPLS0kmVbYB4sF65U+Csvbg0Lg=; b=tLxasMCm37l6AgdUUMYlalSMUfFg3yb1H58MQqtfPdSNMGHujARC4nm/a2y+uVPhl5 Nzda76LH5xtALpJc3tZ2B+wAk8rPR/zRJIDGMLpG0ZplgrkgD4WwhZTpBGouPUcJtsTE SvVLP78mfif2nF0Ai/JiGybPoDABoYESH4yDcCglRV0t8CAJVQRO6YUC2C4yUMqoXAyG /kfQqcbkHVpPzj8sr7cGF/ltnMDXXPeKakD6bN+xsU50pSHyrrRLkaUeYKm3u6pi5lUX mTJFPgIxMT/Y0j91M4Ks+pdOcYSYve+bRAcZaQVMJOCvuB54G8vsMF8kCQyps+1msogX P7ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=C9EG5Wbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b141-20020a621b93000000b0064762d151fcsi4553842pfb.183.2023.05.22.04.33.39; Mon, 22 May 2023 04:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=C9EG5Wbh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232730AbjEVLZ2 (ORCPT + 99 others); Mon, 22 May 2023 07:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233322AbjEVLY3 (ORCPT ); Mon, 22 May 2023 07:24:29 -0400 Received: from mail-il1-x149.google.com (mail-il1-x149.google.com [IPv6:2607:f8b0:4864:20::149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7390D1FE5 for ; Mon, 22 May 2023 04:21:17 -0700 (PDT) Received: by mail-il1-x149.google.com with SMTP id e9e14a558f8ab-3379306f979so44383325ab.2 for ; Mon, 22 May 2023 04:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684754473; x=1687346473; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=o+eiSCYBIOLnXleM2cPLS0kmVbYB4sF65U+Csvbg0Lg=; b=C9EG5Wbh8NAca3HjpjmAkkfiJOSWePs85XQ0SpLIeqp8Y36SY1afe0SjxeJrOVPo6f rSTwoLESGNR9S18BZs0XrVxCYBqlhtSsvsgR2iojCBGnj54TMjYktW5nrViLzni0xpfL tpHduilcVggl7fPEhrjrec8kFcN7FgXLx/UQvnavGFY3ToTtVRLe8AuaepJNGO46Xg3W PKmykBBAg2AmrTeW/xVoMYteYDYOJK3FGm+N6bAky/KArU7NP7tyEyOOlhPbM/CDmkkw LJm5ghP/vmQqL+HKiYE2ccHd75NzsmQ8g1/MPJePiH2Y7A0qOXy9H2rvvWXwRBzzaq6i gJHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684754473; x=1687346473; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o+eiSCYBIOLnXleM2cPLS0kmVbYB4sF65U+Csvbg0Lg=; b=i8sUGI+VroEHn3LYDDeCykR9G2yPZ9ZGkUUrUlb+8Nl8pD2EEufeVeGXBgTw4ArlTn lRCNRFKz7FxOL5z5gr6CUAWqenBlfjCjW1EgFWK7n1tHOUjOVawUdASsQwaaQnWO1rRb Ex14fkVTFmnEcJzlt6sHRfCgpaNEY48ZAUGqUoL8C4aIJpZ9+vZWCgafzeSESlZ7GRlM 38RZy9nY0iW5d0jmnVtnO2eO13YDElUOitlWSPK5SQpuL3OWu3tLNDLSRSA4KYDBVKNh PvIpQW6VHauBuEUky1aDbm+NOa9ypoXS33sxM2RHu2qfuMpahptOQSJtjUEWJCQrQOnw MtSw== X-Gm-Message-State: AC+VfDxS6ENp2V1QKJFKI4P+Uy2RrIoDOM9lGpWCXl47VFKWqtPzdNoQ wFHz8V9T5L+B/IuQrFuOXs/26+ko6EHU6Q== X-Received: from talumbau.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:90d]) (user=talumbau job=sendgmr) by 2002:a92:de0c:0:b0:335:de72:23c7 with SMTP id x12-20020a92de0c000000b00335de7223c7mr5716366ilm.5.1684754473156; Mon, 22 May 2023 04:21:13 -0700 (PDT) Date: Mon, 22 May 2023 11:20:56 +0000 In-Reply-To: <20230522112058.2965866-1-talumbau@google.com> Mime-Version: 1.0 References: <20230522112058.2965866-1-talumbau@google.com> Message-ID: <20230522112058.2965866-2-talumbau@google.com> Subject: [PATCH mm-unstable 2/4] mm: multi-gen LRU: cleanup lru_gen_soft_reclaim() From: "T.J. Alumbaugh" To: Andrew Morton Cc: Yuanchu Xie , Yu Zhao , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-mm@google.com, "T.J. Alumbaugh" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766593902299286978?= X-GMAIL-MSGID: =?utf-8?q?1766593902299286978?= lru_gen_soft_reclaim() gets the lruvec from the memcg and node ID to keep a cleaner interface on the caller side. Signed-off-by: T.J. Alumbaugh Reviewed-by: Yuanchu Xie --- include/linux/mmzone.h | 4 ++-- mm/memcontrol.c | 2 +- mm/vmscan.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 3a68326c9989..5a7ada0413da 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -534,7 +534,7 @@ void lru_gen_exit_memcg(struct mem_cgroup *memcg); void lru_gen_online_memcg(struct mem_cgroup *memcg); void lru_gen_offline_memcg(struct mem_cgroup *memcg); void lru_gen_release_memcg(struct mem_cgroup *memcg); -void lru_gen_soft_reclaim(struct lruvec *lruvec); +void lru_gen_soft_reclaim(struct mem_cgroup *memcg, int nid); #else /* !CONFIG_MEMCG */ @@ -585,7 +585,7 @@ static inline void lru_gen_release_memcg(struct mem_cgroup *memcg) { } -static inline void lru_gen_soft_reclaim(struct lruvec *lruvec) +static inline void lru_gen_soft_reclaim(struct mem_cgroup *memcg, int nid) { } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d31fb1e2cb33..738ba18f3a0c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -485,7 +485,7 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, int nid) if (lru_gen_enabled()) { if (soft_limit_excess(memcg)) - lru_gen_soft_reclaim(&memcg->nodeinfo[nid]->lruvec); + lru_gen_soft_reclaim(memcg, nid); return; } diff --git a/mm/vmscan.c b/mm/vmscan.c index cf18873a36b9..e088db138f5f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4846,8 +4846,10 @@ void lru_gen_release_memcg(struct mem_cgroup *memcg) } } -void lru_gen_soft_reclaim(struct lruvec *lruvec) +void lru_gen_soft_reclaim(struct mem_cgroup *memcg, int nid) { + struct lruvec *lruvec = get_lruvec(memcg, nid); + /* see the comment on MEMCG_NR_GENS */ if (lru_gen_memcg_seg(lruvec) != MEMCG_LRU_HEAD) lru_gen_rotate_memcg(lruvec, MEMCG_LRU_HEAD);