Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1894586rdb; Tue, 3 Oct 2023 04:39:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGD2zxkYv8rMGHpSjVgdOTpl3TCC3IkJ/sSr2FSL2Y9MSpMLmpte6JjVu7p7TGfq1jhwXsT X-Received: by 2002:a05:6a00:1748:b0:68e:3eb6:d45 with SMTP id j8-20020a056a00174800b0068e3eb60d45mr13309056pfc.30.1696333176276; Tue, 03 Oct 2023 04:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696333176; cv=none; d=google.com; s=arc-20160816; b=yAxNle55u+YE0Mjck9KWdM164UoloPH9Z0UvmpGPKlM3BTS66E9AppPajnweLVS1iF tyegSSMr0kQZZOv7oSMwiXEQULWzx/5HQ+2+onsDgOOlouKmT5fq4MRtzcqhR11em6RX BemomniWSZcvHPB8TiRtTMQQEtJaZx63rZgKbN3SeGqSTY3Fw4XcYiENeZEsTzHPZOcH nwBh02hz1GvtnGN50Rz/pwIDCBZLbrIFdVaktcUiRmyH1wHGWuh73tpuWqvliWSOfy8L Neqv5QUH1q/yvb5++sqhVdd5IpAkSIwqY7oXnpScqI+XKwvQxMmrQ5hM6oeaEaOKEKiJ R+Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=k2j351NRIVQaw5o8Q4hyTB1ENQEJHk6+YmVaoaUY9X0=; fh=SJZUp4kXclF9IlFpx+CyKtiLoTQ5B0Z8P0cJvOdB75Y=; b=q0dFAmqV4rfFG+hnTI5g76skaNy2KOGzEvLXtFZ2/eluLiZKwiUVIdCS0ARe05Gx5y FkfuWHL7lLVo8Ve3ythIMI6PQy2+c1eFbsDsAzRTPoYNpVZ71h0D+hlPieHaF8fQy0Qv lSnu80Puh8RU1ZSjnVuYLp3Z5/386Ih2hmv7iLU+2GedjDA4yw3/b6MtRFRjJobmS6x4 phdADKb1DJt9SIyOquryEfgy8iaiGiLEZ/gG+odS+c2F4R+peJ+kF21Mb7msTFT59SaS JvdKkZyGFFwLM6pJursdwCmryPt+UoKLFsUIqJgTMUIsE6EIjoA8Kzdx4KEm+9WpCVbi 9fTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ffSYYHcn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t20-20020a056a00139400b0068e2b901138si1294444pfg.158.2023.10.03.04.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 04:39:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ffSYYHcn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 49F0F812D21C; Tue, 3 Oct 2023 04:39:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240523AbjJCLjf (ORCPT + 99 others); Tue, 3 Oct 2023 07:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239955AbjJCLje (ORCPT ); Tue, 3 Oct 2023 07:39:34 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEEE9B for ; Tue, 3 Oct 2023 04:39:29 -0700 (PDT) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20231003113926epoutp03994d6b82e54288a7f19d973ed6f476e9~KlgcAN1C91684416844epoutp03a for ; Tue, 3 Oct 2023 11:39:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20231003113926epoutp03994d6b82e54288a7f19d973ed6f476e9~KlgcAN1C91684416844epoutp03a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696333166; bh=k2j351NRIVQaw5o8Q4hyTB1ENQEJHk6+YmVaoaUY9X0=; h=From:To:Cc:Subject:Date:References:From; b=ffSYYHcnB8VYLlKV9BHjppxv6d/Af9y5Eendw3maQUSlphr3UbSvEP0WD1pn6mV3x 9LxT63a8R61CEMBaiWN0cocs22Fn1myuYxUv2QF8b51gLVoaipQWDXB63akwFBRI+c LoEhC1lKRl9BBPVzt0t2z46TDJMYAtOsMZ15BDDo= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20231003113925epcas1p3319abbc47fe7591c8f78aa336aacb2c6~KlgbZ0szS1150311503epcas1p3t; Tue, 3 Oct 2023 11:39:25 +0000 (GMT) Received: from epsmgec1p1.samsung.com (unknown [182.195.36.222]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4S0G7d3858z4x9Pq; Tue, 3 Oct 2023 11:39:25 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmgec1p1.samsung.com (Symantec Messaging Gateway) with SMTP id A8.71.08657.D6DFB156; Tue, 3 Oct 2023 20:39:25 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003113924epcas1p25751edd2f3bcbab701edd7ea9db5e4c5~KlgaQj7ct3062830628epcas1p2b; Tue, 3 Oct 2023 11:39:24 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003113924epsmtrp1006c24c108414543543dde76802e8cff~KlgaPv7wH2168921689epsmtrp1R; Tue, 3 Oct 2023 11:39:24 +0000 (GMT) X-AuditID: b6c32a33-4e9ff700000021d1-f8-651bfd6dd185 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 45.88.08742.C6DFB156; Tue, 3 Oct 2023 20:39:24 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.99]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003113924epsmtip273eb99b74ecf8aa5978d95756d3070fb~KlgZ9Qh8W3008230082epsmtip2W; Tue, 3 Oct 2023 11:39:24 +0000 (GMT) From: Jaewon Kim To: rostedt@goodmis.org, tjmercier@google.com, yuzhao@google.com, kaleshsingh@google.com, akpm@linux-foundation.org, vbabka@suse.cz, hannes@cmpxchg.org, sj@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH v5] mm: multi-gen LRU: reuse some legacy trace events Date: Tue, 3 Oct 2023 20:41:55 +0900 Message-Id: <20231003114155.21869-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphk+LIzCtJLcpLzFFi42LZdlhTXzf3r3SqQd8WYYs569ewWaze5GvR vXkmo0Xv+1dMFk37ZrJbXN41h83i3pr/rBZH1p9lsdjX8YDJ4vDXN0wW79Z/YbOY3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joCwuH EktxRqKhFnNRcSIAyJN4bsYCAAA= X-CMS-MailID: 20231003113924epcas1p25751edd2f3bcbab701edd7ea9db5e4c5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231003113924epcas1p25751edd2f3bcbab701edd7ea9db5e4c5 References: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 04:39:35 -0700 (PDT) As the legacy lru provides, the mglru needs some trace events for debugging. Let's reuse following legacy events for the mglru. trace_mm_vmscan_lru_isolate trace_mm_vmscan_lru_shrink_inactive Here's an example mm_vmscan_lru_isolate: classzone=2 order=0 nr_requested=4096 nr_scanned=64 nr_skipped=0 nr_taken=64 lru=inactive_file mm_vmscan_lru_shrink_inactive: nid=0 nr_scanned=64 nr_reclaimed=63 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=1 nr_ref_keep=0 nr_unmap_fail=0 priority=2 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC Signed-off-by: Jaewon Kim Acked-by: Yu Zhao --- v5: reuse the legacy trace events v4: wrap with #ifdef CONFIG_LRU_GEN v3: change printk format v2: use condition and make it aligned v1: introduce trace events --- mm/vmscan.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 6f13394b112e..3f963f3616ea 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5005,6 +5005,7 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, int sorted = 0; int scanned = 0; int isolated = 0; + int skipped = 0; int remaining = MAX_LRU_BATCH; struct lru_gen_folio *lrugen = &lruvec->lrugen; struct mem_cgroup *memcg = lruvec_memcg(lruvec); @@ -5018,7 +5019,7 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, for (i = MAX_NR_ZONES; i > 0; i--) { LIST_HEAD(moved); - int skipped = 0; + int skipped_zone = 0; int zone = (sc->reclaim_idx + i) % MAX_NR_ZONES; struct list_head *head = &lrugen->folios[gen][type][zone]; @@ -5040,16 +5041,17 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, isolated += delta; } else { list_move(&folio->lru, &moved); - skipped += delta; + skipped_zone += delta; } - if (!--remaining || max(isolated, skipped) >= MIN_LRU_BATCH) + if (!--remaining || max(isolated, skipped_zone) >= MIN_LRU_BATCH) break; } - if (skipped) { + if (skipped_zone) { list_splice(&moved, head); - __count_zid_vm_events(PGSCAN_SKIP, zone, skipped); + __count_zid_vm_events(PGSCAN_SKIP, zone, skipped_zone); + skipped += skipped_zone; } if (!remaining || isolated >= MIN_LRU_BATCH) @@ -5064,6 +5066,9 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, __count_memcg_events(memcg, item, isolated); __count_memcg_events(memcg, PGREFILL, sorted); __count_vm_events(PGSCAN_ANON + type, isolated); + trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, MAX_LRU_BATCH, + scanned, skipped, isolated, + type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON); /* * There might not be eligible folios due to reclaim_idx. Check the @@ -5194,6 +5199,9 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap retry: reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); sc->nr_reclaimed += reclaimed; + trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, + scanned, reclaimed, &stat, sc->priority, + type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON); list_for_each_entry_safe_reverse(folio, next, &list, lru) { if (!folio_evictable(folio)) { -- 2.17.1