From patchwork Mon May 22 11:20:55 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: 13250195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70006C77B75 for ; Mon, 22 May 2023 11:21:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7959900004; Mon, 22 May 2023 07:21:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E28B5900002; Mon, 22 May 2023 07:21:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1789900004; Mon, 22 May 2023 07:21:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C2B3A900002 for ; Mon, 22 May 2023 07:21:14 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 88CE11404F9 for ; Mon, 22 May 2023 11:21:14 +0000 (UTC) X-FDA: 80817649668.30.714F4E2 Received: from mail-il1-f201.google.com (mail-il1-f201.google.com [209.85.166.201]) by imf13.hostedemail.com (Postfix) with ESMTP id D239320011 for ; Mon, 22 May 2023 11:21:12 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=chESpP8R; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf13.hostedemail.com: domain of 3J1BrZAgKCJ4R8JSK98SEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--talumbau.bounces.google.com designates 209.85.166.201 as permitted sender) smtp.mailfrom=3J1BrZAgKCJ4R8JSK98SEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--talumbau.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684754472; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=tjbotIl6dteDpFw7M2HIwfdcqW8YhSXjziuk6U7H4Oo=; b=IAd1MkbcQDgcH5IbrS4hTiIEKDisU6tVBaDrQM0gWO4ph4HDFY7gbN8CO5pcQfbNM+w8U5 aXyhCT8KspXUejHHhap0M85gx4VJY5hl4cvfmJZlFI/clljX1HxGXaF/8mchUVvzR0F1Fj 7EL2mJimc5W+73NapswrWeyY5PyGAdE= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=chESpP8R; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf13.hostedemail.com: domain of 3J1BrZAgKCJ4R8JSK98SEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--talumbau.bounces.google.com designates 209.85.166.201 as permitted sender) smtp.mailfrom=3J1BrZAgKCJ4R8JSK98SEMMEJC.AMKJGLSV-KKIT8AI.MPE@flex--talumbau.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684754472; a=rsa-sha256; cv=none; b=O4ddciH67LtZphmkuuGhVXCN7pk5pBPWOVfP3yEiT3SjtWELv9SAYzYxHCT3HUM6JKPlPm Cgw3xEPWwMDzerOZnzhugORngAtCYHV6M+XFd16K27DC3wY6ctrX4W3B+adjq3oTfD+h5g mQdUljqow21bxtJAgBNzDmscrTC+l5I= Received: by mail-il1-f201.google.com with SMTP id e9e14a558f8ab-3381af7e466so93366315ab.2 for ; Mon, 22 May 2023 04:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684754472; x=1687346472; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=tjbotIl6dteDpFw7M2HIwfdcqW8YhSXjziuk6U7H4Oo=; b=chESpP8RhTjBYYVdguowYuRgIznzG4M2UF9I7tFZtlG8zb2E0krTaM/+YPGrU8lWr7 l/ys2WLnJQP7hnutQyiv7RNRbbcPcCKWKSYiG5hc0J0QT7WfehDUyCSIFZbvY6XzplnK kxMCdv2IBYm4MP4HlRbMs9m1RwRcMyy2i5IrR8FpwbTiEGvFv5gb7Jr4uzHdURDpMXPq lPDRcdGUF3kRVoBf/nZGEJdAB+wBQltqNBDiTKDRwz1tJqIrABPqDnDY4h9pUGo4VXHw ZqM5JpkVP0R1tDNbnzeIIV3YCvOaNhpBgQTK6mvck7LioQUhlY6FyFvE5tc/7k6XnuKM JDuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684754472; x=1687346472; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tjbotIl6dteDpFw7M2HIwfdcqW8YhSXjziuk6U7H4Oo=; b=O8dIscBAhTnle8pgsmqE3BbAFShk8GQtPe/lxMt4f4XMztkSin/VoEubmpywq7W/9/ sJdGk3nqdwx8SQKLcgIYEBEeQExJGpKpyf2O+H2UJr7RpZleL/xPfmjha7nr0sV+KTTI FydhSZcxJcDrWGLOPLcFMASaFNxDIQISZFkxyRv4SxCmqStnOGAJWbIJNMGEqGvE1gzs h+IuoS0hbks0hPC2mdr7+MLXh8+hso/j/wywWppD3Py5pC7dHKa2qkaSacAVPW5gb2L5 Wi4Ith1/aAORC6HP7bPPAgh2kXlYbVwraRSPewrbOvAYfEBJ4hijT+i3ASkpIWKgtKW6 8AMA== X-Gm-Message-State: AC+VfDxrV5JHRGPS4ruhykVCPJ650iBVS4W+wMS9Uuof05cChH/8/PGV 3Ifmieo1BvoJdx8QrkA05S35YkSIrJeUcw== X-Google-Smtp-Source: ACHHUZ7UWSQwQGsHd72I/yejf19ofrwyt2xX81bG/zc8LpBQfPH0BVPAIm5/Niti+tcKANdc8o7V/lNN1cV5bA== X-Received: from talumbau.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:90d]) (user=talumbau job=sendgmr) by 2002:a92:cb44:0:b0:335:479a:8eaa with SMTP id f4-20020a92cb44000000b00335479a8eaamr6111039ilq.6.1684754471949; Mon, 22 May 2023 04:21:11 -0700 (PDT) Date: Mon, 22 May 2023 11:20:55 +0000 Mime-Version: 1.0 Message-ID: <20230522112058.2965866-1-talumbau@google.com> Subject: [PATCH mm-unstable 1/4] mm: multi-gen LRU: use macro for bitmap 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-Rspamd-Queue-Id: D239320011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ut1ijux5t3bcuatye7ggfo19eur4yiuh X-HE-Tag: 1684754472-209091 X-HE-Meta: U2FsdGVkX1+/hIs/T1kD0R6uFVop99esRVNmALvxrlGgfvWTiBl4QtHda22YefnjE8W3wJlMGKluHHE7IxiFaUfF3VYiy4ry3insjIWhbuYXiUTAncbFnt4H9SIqYxiQ79aq/+ietXlII3JS/PGlZThCuuAlDxjHZUjaZB6WqFuSuaOtPh+vXJ5xj0g6bp2EzHNGrwdwHhAKPppFK099XMPcsP1gPQasm1C2+qh6gU6s0zQar0iL8y+e1ejMrQhAdTdl0yNopyouxGBA440iyTvMtZCySLSylS2H0iq5pJTMXmp2Ng6TPFk4yJtRFG+Q4yE/0ngrQ6330WbiCn7eUs4Euj5bBbX2xymLquhLxBVW7UHc/jEFv92xIygJ+Woy91/FgscdliIR+oojJS7GpQ30PAp77qE/7K/CzIDqWNL0w7+M5JjNGnpU+bfCgOfoAp6Hncvp7gg330WByheBGFyxraC7fg3EZgknT/7fd66SbQd/RnQ1rxThpHz1loRFoS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Q4I3sePoFVxikztUoIiOUmdS9ew== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000033, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use DECLARE_BITMAP macro when possible. Signed-off-by: T.J. Alumbaugh Reviewed-by: David Hildenbrand --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 4637f6462e9c..cf18873a36b9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4144,7 +4144,7 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end, unsigned long next; unsigned long addr; struct vm_area_struct *vma; - unsigned long bitmap[BITS_TO_LONGS(MIN_LRU_BATCH)]; + DECLARE_BITMAP(bitmap, MIN_LRU_BATCH); unsigned long first = -1; struct lru_gen_mm_walk *walk = args->private; 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: 13250196 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65D95C7EE2A for ; Mon, 22 May 2023 11:21:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 021A8900002; Mon, 22 May 2023 07:21:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEC92280001; Mon, 22 May 2023 07:21:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6686900005; Mon, 22 May 2023 07:21:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C6BF8900002 for ; Mon, 22 May 2023 07:21:15 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 97E0F408F7 for ; Mon, 22 May 2023 11:21:15 +0000 (UTC) X-FDA: 80817649710.20.58FF37F Received: from mail-il1-f201.google.com (mail-il1-f201.google.com [209.85.166.201]) by imf07.hostedemail.com (Postfix) with ESMTP id DE93D40017 for ; Mon, 22 May 2023 11:21:13 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=C9EG5Wbh; spf=pass (imf07.hostedemail.com: domain of 3KVBrZAgKCKATALUMBAUGOOGLE.COMLINUX-MMKVACK.ORG@flex--talumbau.bounces.google.com designates 209.85.166.201 as permitted sender) smtp.mailfrom=3KVBrZAgKCKATALUMBAUGOOGLE.COMLINUX-MMKVACK.ORG@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684754473; a=rsa-sha256; cv=none; b=cZDwPxF8snfid8NXFYxbAha6qpj5m8Lr9aYdg5Q0tQAINLkwcXZafnpEtCSXB2HYg8hxYy OxvuyNhmTB7VXEkD9cvI7tt8AYmA3VLbmg/fZZb4uIuzMF1feS4At0sm6vuQFF+tBwnFUR 8eQEyX9yHj3FyaxQYAS8kPwgAWJaWW8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=C9EG5Wbh; spf=pass (imf07.hostedemail.com: domain of 3KVBrZAgKCKATALUMBAUGOOGLE.COMLINUX-MMKVACK.ORG@flex--talumbau.bounces.google.com designates 209.85.166.201 as permitted sender) smtp.mailfrom=3KVBrZAgKCKATALUMBAUGOOGLE.COMLINUX-MMKVACK.ORG@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684754473; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=o+eiSCYBIOLnXleM2cPLS0kmVbYB4sF65U+Csvbg0Lg=; b=8lxS4AgMjyoy5sresNqjnLaH5Dxt7bBCc+AypVbmfAFcW3PlPa6OtxqOFcXu4F4XBq8mHR pdplhJ4ZrgnjYH+2ynfIDWPh/EZyplORqYJhYUD42dnyZbr7EcVMYybHuoEawZb648e+kS HE4W4ASwwjKexPxhI1frIEWbqEsmuqU= Received: by mail-il1-f201.google.com with SMTP id e9e14a558f8ab-331139b46cfso44403695ab.1 for ; Mon, 22 May 2023 04:21:13 -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=LeGlHaraP44L/LrccKkZT710AKG/1XO0sgkxrJuaRoaUZtc/wtjEW+jWcXhdj5qTl4 3YUy0VRucu8X15LbQX3rHOYrs67P5TQBzsphWwPMhnE21rhz0Q7UGLricWF+pGJAPfrv gs5QkzXa1zdlr1MDWLbGJLUZixbr6UMDGIxk5oimqMZ7Hxhej7iVr/hLxGRYrQpfWA6Z zDcQIMH9ad9DDbO9AYMHVsIWd8g/m5TL4225/4zZRL/KHgkZiwKsvDO7ESEAQkCrW4AS 33sIB3hgx71XAs0S/BnRjOskx1PWV5ZI88gOuxuhfVUjKNfZqe+/RbuylApG/wZYoG6i R6nw== X-Gm-Message-State: AC+VfDzPUzc179I8OIX4nE0/CY/Xl/hFEBTDJ9qR+OSE2RI9/Mqy1T8e ulrTOJIqLtWk9QLJ7krF+8XZrym1K9/Mmw== X-Google-Smtp-Source: ACHHUZ4vJ1lQN67iIZEPDxHAxhJZkjHqPcnLJHh8uV4pyRQYGhMr5+pfTS+wcM2amtB0h9nui5VMYlPWy5TTRw== 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-Rspamd-Server: rspam08 X-Rspam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8p4SgWKrRPcep UYieXpRE ntVQYw8Kyiqe133evMlYZY3bgLMSMx+lafskjczfv4yCIbKOyGV0N1ilXLKV44n9YxeODs/hSG+eqFS1ibgsAoTQz2LWxsZ08H/4UWevO+eKUAYIZxyJyZLrWNT96lbcZanmcIoWxdmh+YU3rw4GF7i56IUrVeepCjEFyZVXmFrlzKX4rW03oP1/X6fxmeSF0WMs6qdlbvFVazwntgVovD7ifwgzb1b2IlCh8AOqgY5w3nmM7CpAZSjjYm2fcUUyMjoIRMp3JefsQOaWh+C75gOaHfUpnt8Ahn1DUFWOS901V+fPI8duCwIwD8ESoSuZc4akE+oSGoicG3ov10cMUnzlZ5Mhu2ganw+qV8FOQjqfTjGLEuFF+MPgYhu+rGfnyDUn+vLvRyO4xRqpfml4Lt+U63i4McxUA2gcgYjb99nABvhjEaUu7ylR8P0BmDZkG74qpRNPznDv81c0Z79CEy8biHKAxrXiynatNm2V8rw9H4Gt1d2JCyuZdd618XJiQky5SapVIWZV/HltvD4H5Z79NdTXIdaIzxdeDdItdE75Z5G+41sF9rIrZzJKIE0/+sFnPH6M03tIibFAOAobi0ARVYQNoY+R09ijaE1furH9fxPvzSAcTdUIlmKkO2Mh70y003eaEEI3tKPZ6BKxFDMbsNZa/VYv3d6Is X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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); From patchwork Mon May 22 11:20:57 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: 13250197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA92C77B75 for ; Mon, 22 May 2023 11:21:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C390280002; Mon, 22 May 2023 07:21:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 774CD280001; Mon, 22 May 2023 07:21:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED6A280002; Mon, 22 May 2023 07:21:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 50EB5280001 for ; Mon, 22 May 2023 07:21:17 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F1B0C1A0D91 for ; Mon, 22 May 2023 11:21:16 +0000 (UTC) X-FDA: 80817649752.08.5BB073A Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf26.hostedemail.com (Postfix) with ESMTP id 3CB5814001C for ; Mon, 22 May 2023 11:21:15 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=qWkhlrfi; spf=pass (imf26.hostedemail.com: domain of 3KlBrZAgKCKEUBMVNCBVHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--talumbau.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3KlBrZAgKCKEUBMVNCBVHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684754475; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kdK6cg22OO4qOyQXs9xKaUltuTOUFz6FCWZwVxCh2Hw=; b=pWnvRbY/K7y5uUiaIby+YiGShP54J0ytaA8OcbMNqLaVp4dPnGSZIYQg46KsWcovP4uMSV 3ciWu/i4AX+OhR97RjPoTczTeuaqcQGZJvry2T5upS0AlrGH/eeBU6bd78c7W8UxHg3wK5 nN+EVITZr3nhtoM0L9uyQm/PWwWza58= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684754475; a=rsa-sha256; cv=none; b=wNAmOtkBZdNuHHeZkMi3sKKqrt5PHykyud7AORz0LZIjQFbnLQMNwVW7feoDelyFBdEDfy AxCmXUWhkV5ADejDAe9oui+NEzbeyi0n0sgNSmUYC2pWi4+I03YLoLbaHeKQ6xWBlwvWLc nXz9058nuPqOQF7RGkVmBW5VW9jelMQ= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=qWkhlrfi; spf=pass (imf26.hostedemail.com: domain of 3KlBrZAgKCKEUBMVNCBVHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--talumbau.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3KlBrZAgKCKEUBMVNCBVHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-ba83a9779f3so11593837276.1 for ; Mon, 22 May 2023 04:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684754474; x=1687346474; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kdK6cg22OO4qOyQXs9xKaUltuTOUFz6FCWZwVxCh2Hw=; b=qWkhlrfibgnL4RhQHj7B1l6RBrzRaJLlA4S+q3+9iSaHf1FoZjrbjIeox0pMD4akA6 baQ7YGto4El4LBM0QVJP4cql3S/UP2QCxjMxcH7zZ5WU2ZmYY0a2LN1Q9hftLvUgx6xY uXUXdOY22m4wBBpuN+E+S8/WR8wVUIBuOpCWW0NW5nnfixtNx9Op2M4J0Eea727f7z1S sf3g9TCIQtAIo4Vtb/9RoX4qfTdUkuWDMiPRz3BajpDxdF5yZCBeE2pRNa/l/Mg0f+eq /DBmBGIyvEk0YXmD4u8BuGDulx27iox/80TqcG8JU2bBdNBSanhjgzZa8EFs7/ImsyhS /GFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684754474; x=1687346474; 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=kdK6cg22OO4qOyQXs9xKaUltuTOUFz6FCWZwVxCh2Hw=; b=PSObl8RrPIbEr/gQOJoeGrce/RiSp/Apl3VrUeWBgIl3VCSr6lInc4ngm1WrFnfCry PB8odWPIHqu1ew5DP+i6mjsl+RstrYFbZ+FVSSlwQe4eDC651bhKmMoJ7ziN0JFJeyPk 2Sp3Vv5ZC8DGr3rn/hNE2y/YslkAPBLyH4XBL2TTu/R+WVQoftsP5x1TX67ZHxuyNBuE 4xgW0sKcViSElRNsURThUPuTrSU1AkVCX9D2cfNv6DxrJPUc9CZ9FeRHJ/qwIuvFSWD1 Y6Ay8W8EIFA9dWR4HtddPy9ItizSEktxvnN5tds3p4bGrk4O3woguYsQfy9n9jsT3MzU PKlQ== X-Gm-Message-State: AC+VfDz6KZNEMnRfbjr6JvIB+mX+0wbx9vBO1xtM/ne+bSEdijijFSNe aBPyAHkOi1L9Mu2PYnOB7sMW5lrsbnyFcQ== X-Google-Smtp-Source: ACHHUZ446Fd/FV7ov35m5UQMLmkLqc0ZI7PlRhDVjQ/W3/nS3VNBnb0IdrQrR6Vu/5xKg9r94Z/zbNEve8+TSg== X-Received: from talumbau.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:90d]) (user=talumbau job=sendgmr) by 2002:a05:6902:56b:b0:ba8:91c2:268a with SMTP id a11-20020a056902056b00b00ba891c2268amr6184995ybt.0.1684754474384; Mon, 22 May 2023 04:21:14 -0700 (PDT) Date: Mon, 22 May 2023 11:20:57 +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-3-talumbau@google.com> Subject: [PATCH mm-unstable 3/4] mm: multi-gen LRU: add helpers in page table walks 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-Stat-Signature: escbnoypy9ra7j145ezxcc4xzanuqjzr X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 3CB5814001C X-Rspam-User: X-HE-Tag: 1684754475-367389 X-HE-Meta: U2FsdGVkX18vDzjrryulml6kEmxrmgOGFSkCD/MCYZSRk2/V5hm3zLdnaLYgNkV65iCfW356A71VAjQ2m87iAPON0yBY+1il5glpGIbgGUm5TElUz6CbYetjtLRyto3I3HyAsQbQfEA5LEacY6NuvBSpOFGUte3L9yaL6t/qFsqe5B+PyIyBIE1TV81hx/PmwnXEhKGcz2bdGs/7GFEY38Z/r+xliwEp19w754zih7gbCKLe/QJ+T0vvMzpwS5fE/pcTcEnyidCAQHONC8mMeH6qNKHxH63GcN78OGpYSg66WJyhHabp4SenDf41ZnC9X2xwdU3uMfmkIx4X2OKdscK1W73Dk7i0nGBzH9d+PlToJYZJ3/gmdhsL7wHI8v4nnbOfErLaa8ta2GN8ZbUXkNXHQ15Ez12dVwdsZEZJQazAHuSPm2w1lHhrmf/Cp7uvZ6iExTQqSW97FYGpJUJ/5/F5VRJO0EizBzF6UPQ8nf8PyR7ye//efslb+YuPRRBKt6paqBHmLlIIuLfjQqmKgWUUe2GsyDJptvMYaG+PlUYraNRzO2TEUnK+KAf1Kc/hun8Jefo47qUdCu9cyEdO4z5uGZCHT+wZOW2MmyngmkYNw/xy8PxardEAlGtaARFnY+6xTFay+gN+rABQyfkmDNkJeuVfY/lXZmNP1lWgqw29jqZlOHxPNWndl1ML42/jC6HpomQvATFX/og9Nvw7arS62sObTgCejMiob+h3hYsb+c4lUOVj6WgfGFw7KUWSj1Ue2CuazvE14YPLZDk5iLP+eujRxIg897Ja1Nd7q2sVqQlLkUqnBfvXopMequrGe6R+CoAmqVxTIFgrJPBJoxbVcnEd1RL7vGcsAVXwa9naAOi5StJmTPH9VX1GKCTBHBobqo7HkItin5UTTNF3hHsrJKWZ8QpqZLfpnQLHVMtCAlTiAzhj+Ds9syj1qJtBzJ3dUwpcSC3giIDfEjP rGf0blKG 6ffKYF8+KFO5lp2Z6tzd7RPBdBZqiSvG4ypMM/VXs+FyOEUxmEoKzkeaXUMNIMhi4PHErlq8O+cIlVcE7jaPZBpjPkZJyuXFRFANHobKe0SV76Ux90s0myruJrklUbdE3EZyp92CLbz6YlFU8frmdAUwixPsmQXhd0XG/Unzysm7HLk92yibBbyDFjuRyDoDP2KRa6ovtrqYemJocUTCRZTr6o+kwjU8m/WtnHFaSbMkcjvJWVAJrxVC/i9qrjhwn3TpZ2keuslJObLIBCh9qzA+b0Q7a4LXTgPpTTfWGM19Kz+2lwHXJuxAtrPSBw2pdILlVFXGlCDG/mAbGKMGZRDkmvXV+HipGKuxVZRAlyCpdqi4vD0YR8ApEKUEpfDdyue/rixEp5//HAEv4VJI7OHHuJd1ieISvpDPFyCwts/DhXLi2e/Z6t3eYl57eDG8L+AT72Tcbbxuat85zisjnznPoI+bs2Ij06IrfoOkP33vnwFL1COKX9ajSfPRHoq5G4+RmYA2Q564RAIlexB3w3Ytbu//4sTJLt1cxEEQk9Hn3seWKAq1uuTPEXwthNzcXejWqqJ9hrNDA4OpntH48BipVhqA5/Nboot0bL+pTqJZMCZcBpGuk6D2HUA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.041173, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add helpers to page table walking code: - Clarifies intent via name "should_walk_mmu" and "should_clear_pmd_young" - Avoids repeating same logic in two places Signed-off-by: T.J. Alumbaugh --- mm/vmscan.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index e088db138f5f..ad0f589d32e6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3234,6 +3234,16 @@ DEFINE_STATIC_KEY_ARRAY_FALSE(lru_gen_caps, NR_LRU_GEN_CAPS); #define get_cap(cap) static_branch_unlikely(&lru_gen_caps[cap]) #endif +static bool should_walk_mmu(void) +{ + return arch_has_hw_pte_young() && get_cap(LRU_GEN_MM_WALK); +} + +static bool should_clear_pmd_young(void) +{ + return arch_has_hw_nonleaf_pmd_young() && get_cap(LRU_GEN_NONLEAF_YOUNG); +} + /****************************************************************************** * shorthand helpers ******************************************************************************/ @@ -4098,7 +4108,7 @@ static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area goto next; if (!pmd_trans_huge(pmd[i])) { - if (arch_has_hw_nonleaf_pmd_young() && get_cap(LRU_GEN_NONLEAF_YOUNG)) + if (should_clear_pmd_young()) pmdp_test_and_clear_young(vma, addr, pmd + i); goto next; } @@ -4191,7 +4201,7 @@ static void walk_pmd_range(pud_t *pud, unsigned long start, unsigned long end, #endif walk->mm_stats[MM_NONLEAF_TOTAL]++; - if (arch_has_hw_nonleaf_pmd_young() && get_cap(LRU_GEN_NONLEAF_YOUNG)) { + if (should_clear_pmd_young()) { if (!pmd_young(val)) continue; @@ -4493,7 +4503,7 @@ static bool try_to_inc_max_seq(struct lruvec *lruvec, unsigned long max_seq, * handful of PTEs. Spreading the work out over a period of time usually * is less efficient, but it avoids bursty page faults. */ - if (!arch_has_hw_pte_young() || !get_cap(LRU_GEN_MM_WALK)) { + if (!should_walk_mmu()) { success = iterate_mm_list_nowalk(lruvec, max_seq); goto done; } @@ -5730,10 +5740,10 @@ static ssize_t enabled_show(struct kobject *kobj, struct kobj_attribute *attr, c if (get_cap(LRU_GEN_CORE)) caps |= BIT(LRU_GEN_CORE); - if (arch_has_hw_pte_young() && get_cap(LRU_GEN_MM_WALK)) + if (should_walk_mmu()) caps |= BIT(LRU_GEN_MM_WALK); - if (arch_has_hw_nonleaf_pmd_young() && get_cap(LRU_GEN_NONLEAF_YOUNG)) + if (should_clear_pmd_young()) caps |= BIT(LRU_GEN_NONLEAF_YOUNG); return sysfs_emit(buf, "0x%04x\n", caps); From patchwork Mon May 22 11:20:58 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: 13250198 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86956C7EE2A for ; Mon, 22 May 2023 11:21:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04894280003; Mon, 22 May 2023 07:21:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F17DC280001; Mon, 22 May 2023 07:21:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8D1D280003; Mon, 22 May 2023 07:21:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C663D280001 for ; Mon, 22 May 2023 07:21:18 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A67F780515 for ; Mon, 22 May 2023 11:21:18 +0000 (UTC) X-FDA: 80817649836.25.E908077 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf07.hostedemail.com (Postfix) with ESMTP id 847C640017 for ; Mon, 22 May 2023 11:21:16 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=6rDOmfXO; spf=pass (imf07.hostedemail.com: domain of 3K1BrZAgKCKIVCNWODCWIQQING.EQONKPWZ-OOMXCEM.QTI@flex--talumbau.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3K1BrZAgKCKIVCNWODCWIQQING.EQONKPWZ-OOMXCEM.QTI@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684754476; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cIw0V38F7EAw1HDE4zn4HtkfS4SFwenBLbiqkZiF2tk=; b=ByqVTDkX+JYnlQH3pFB6rjmO6EpOYrVSaHE2Yh03ma/PLpqEvmFFhlOGUlfYQrbM3iK54j HWEmwY5Zks8G4v8V7tZUDzXsIMy/g9fGL/GlhucZaN5s+e4WwkC2Zwbqji3CEspJv6OVIK vUxk6YsA4sUPHqwGhI1hM+WS4T2fk40= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684754476; a=rsa-sha256; cv=none; b=cI4HGT5T6scJw83V7gc7Fqbd4DFUqetunooPe/20BCLBncxwabN1lLOJb8oKPtN61u9bj4 EEkBgH+KHnJLf7ii/7Wr9SlX2ty2KADd3gaqZxn0QOaUkLpvVign+I5TPL233wEEFozYhm IWNkUPglSFvRWM9IveOyi+yIr8ln0/s= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=6rDOmfXO; spf=pass (imf07.hostedemail.com: domain of 3K1BrZAgKCKIVCNWODCWIQQING.EQONKPWZ-OOMXCEM.QTI@flex--talumbau.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3K1BrZAgKCKIVCNWODCWIQQING.EQONKPWZ-OOMXCEM.QTI@flex--talumbau.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-564eb7bc5a2so25589747b3.2 for ; Mon, 22 May 2023 04:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684754475; x=1687346475; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=cIw0V38F7EAw1HDE4zn4HtkfS4SFwenBLbiqkZiF2tk=; b=6rDOmfXOGOL1GW8BHq1lsmAkzsCgxjIn29uj6ZLID+SRaLqHrhM5DOXLA1DCB4iRhy a6Sk9ssRLW1lIRe1a08AwxJ0BAccFa/CgrcwVovKZQUfGQmd6jJ0qQPWDFU52nTje6Ve 1q24H2eJS6v/mPNZCYJE19c+FSpEKqVmHIn36QwkuInYq6A35uygUpQ6n7qaQFOqi+vd GFbbq8j/7Gls9AgbMdbyd1j1SVhiG2e54nQdxqL740BwFA6P/sWV6/odg2s/pJ3Q699D 5fHgG36i7bIXayaCDGk3RAO3su0zKcjC2JqYEecZCpk/VU295hRYwRTPKyfriu/y5jff zXAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684754475; x=1687346475; 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=cIw0V38F7EAw1HDE4zn4HtkfS4SFwenBLbiqkZiF2tk=; b=Yllp83p+JrB5/Zd6slIye1+DabLMyxCflP5b9iEoJSGfn+AaEg1YGpZr9VtmnO7Rjh CnhazcM3vYrCMibbdAmGXZOkQaLAfoRNDpLugt0KwAfh1ksscG7ZrwNB3B+a/jM81sCf zCkcq9a0gou4+xTG5cn48tD4nVFB63njuIj/cXcH+JpJE1ddR0UQIdjR3qt/RhUek1Nv YAXD5uitbE45cZN+KgOThkE1fEy/ziAv7wGWes+oqJzH2JBJt5+V1hNnvtulM0v5mHdP l82koEf2ZolunEjzYH4b7QdGqrmvCKSE5OSdwPl7i4NlAq6EeAuQfQ5PFxukQuxGgnBg b2Iw== X-Gm-Message-State: AC+VfDzbmqP8Jn10D6xMPcwrsN4651GJkSUcdOKp3Ry0vWpwzbdEn/ST JjI2yRKWaW35sF5KDpn1yTItqfZiuYaQSQ== X-Google-Smtp-Source: ACHHUZ4DoNgWjW81d3zb12J4YKX9fJCnoBsTiCFKxDr8tt1dmILx5fK2udZ/QgC3AM2KeSxtmeQ5pfTpZG18cA== X-Received: from talumbau.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:90d]) (user=talumbau job=sendgmr) by 2002:a81:dc01:0:b0:561:c98b:8e8e with SMTP id h1-20020a81dc01000000b00561c98b8e8emr6749837ywj.10.1684754475539; Mon, 22 May 2023 04:21:15 -0700 (PDT) Date: Mon, 22 May 2023 11:20:58 +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-4-talumbau@google.com> Subject: [PATCH mm-unstable 4/4] mm: multi-gen LRU: cleanup lru_gen_test_recent() 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-Rspamd-Queue-Id: 847C640017 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: jwhwxafzxcuhx8h3gb5cmg9gd74sxxtx X-HE-Tag: 1684754476-297380 X-HE-Meta: U2FsdGVkX1/h65eCgHxXBcj8vc5mMgrhmmZyyn+gGQvaFTAV8bIw14E0lekzz+WfgxmJOiI9/xtA2s+6mS22WlfXf5HIsEJSg+nbZBeB5Qjcor312dkD0dEVcYn3M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V0JLjZOPgJN+WEttnaozBScuChRgJ0r/c3CnNdRKULC4QRqlKDQbRxp1r/q/MixKbV+D9IOD++5c0CzKZHWKjKarbE4oiYBureZCmjXbsQ/VSlyQkq96EMVh1XqX6vbgxB9pSIRjVh0xmepB2yAL7AlJ/zWDcgGrrDFntlpO2tNMgySwDxOuZGLZdJ6CAxJdx04dugWAZYP87b6d+TBGl6xfEdJZdJ+WL8g8TQ+N5oT+xNoKCtUR4lWbl0CmBCZMajesXBL4weYsPJ3xyD1UUVehS3kEMSACSgx4VDx1rimgnZnc8Jap91l8A5PhJ/QyuZIPagcSlcoYXWdTpWf+GUHbKwBD3lyJHssa2su0207wRMAkJkqEEsfdvfyRP+R5wZg6pXJRieoP7t1JJ/BXJOhUzpJTuHlBfKjffuTaaOFmd1wq8LMHbkIdA8Jx7hmsih+nW3ZKsQR0Gh6H X-Bogosity: Ham, tests=bogofilter, spamicity=0.012039, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Avoid passing memcg* and pglist_data* to lru_gen_test_recent() since we only use the lruvec anyway. Signed-off-by: T.J. Alumbaugh --- mm/workingset.c | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/mm/workingset.c b/mm/workingset.c index 90ae785d4c9c..5796e927e6d7 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -257,59 +257,46 @@ static void *lru_gen_eviction(struct folio *folio) /* * Tests if the shadow entry is for a folio that was recently evicted. - * Fills in @memcgid, @pglist_data, @token, @workingset with the values - * unpacked from shadow. + * Fills in @lruvec, @token, @workingset with the values unpacked from shadow. */ -static bool lru_gen_test_recent(void *shadow, bool file, int *memcgid, - struct pglist_data **pgdat, unsigned long *token, bool *workingset) +static bool lru_gen_test_recent(void *shadow, bool file, struct lruvec **lruvec, + unsigned long *token, bool *workingset) { - struct mem_cgroup *eviction_memcg; - struct lruvec *lruvec; - struct lru_gen_folio *lrugen; + int memcg_id; unsigned long min_seq; + struct mem_cgroup *memcg; + struct pglist_data *pgdat; - unpack_shadow(shadow, memcgid, pgdat, token, workingset); - eviction_memcg = mem_cgroup_from_id(*memcgid); + unpack_shadow(shadow, &memcg_id, &pgdat, token, workingset); - lruvec = mem_cgroup_lruvec(eviction_memcg, *pgdat); - lrugen = &lruvec->lrugen; + memcg = mem_cgroup_from_id(memcg_id); + *lruvec = mem_cgroup_lruvec(memcg, pgdat); - min_seq = READ_ONCE(lrugen->min_seq[file]); + min_seq = READ_ONCE((*lruvec)->lrugen.min_seq[file]); return (*token >> LRU_REFS_WIDTH) == (min_seq & (EVICTION_MASK >> LRU_REFS_WIDTH)); } static void lru_gen_refault(struct folio *folio, void *shadow) { int hist, tier, refs; - int memcg_id; bool workingset; unsigned long token; - unsigned long min_seq; struct lruvec *lruvec; struct lru_gen_folio *lrugen; - struct mem_cgroup *memcg; - struct pglist_data *pgdat; int type = folio_is_file_lru(folio); int delta = folio_nr_pages(folio); rcu_read_lock(); - if (!lru_gen_test_recent(shadow, type, &memcg_id, &pgdat, &token, - &workingset)) + if (!lru_gen_test_recent(shadow, type, &lruvec, &token, &workingset)) goto unlock; - memcg = folio_memcg_rcu(folio); - if (memcg_id != mem_cgroup_id(memcg)) + if (lruvec != folio_lruvec(folio)) goto unlock; - if (pgdat != folio_pgdat(folio)) - goto unlock; - - lruvec = mem_cgroup_lruvec(memcg, pgdat); lrugen = &lruvec->lrugen; - min_seq = READ_ONCE(lrugen->min_seq[type]); - hist = lru_hist_from_seq(min_seq); + hist = lru_hist_from_seq(READ_ONCE(lrugen->min_seq[type])); /* see the comment in folio_lru_refs() */ refs = (token & (BIT(LRU_REFS_WIDTH) - 1)) + workingset; tier = lru_tier_from_refs(refs); @@ -339,8 +326,8 @@ static void *lru_gen_eviction(struct folio *folio) return NULL; } -static bool lru_gen_test_recent(void *shadow, bool file, int *memcgid, - struct pglist_data **pgdat, unsigned long *token, bool *workingset) +static bool lru_gen_test_recent(void *shadow, bool file, struct lruvec **lruvec, + unsigned long *token, bool *workingset) { return false; } @@ -435,8 +422,7 @@ bool workingset_test_recent(void *shadow, bool file, bool *workingset) unsigned long eviction; if (lru_gen_enabled()) - return lru_gen_test_recent(shadow, file, &memcgid, &pgdat, &eviction, - workingset); + return lru_gen_test_recent(shadow, file, &eviction_lruvec, &eviction, workingset); unpack_shadow(shadow, &memcgid, &pgdat, &eviction, workingset); eviction <<= bucket_order;