From patchwork Thu Sep 21 06:22:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 13393681 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 0930ACD4958 for ; Thu, 21 Sep 2023 06:19:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 929686B01FC; Thu, 21 Sep 2023 02:19:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D5456B01FE; Thu, 21 Sep 2023 02:19:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74EF66B01FF; Thu, 21 Sep 2023 02:19:53 -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 627AC6B01FC for ; Thu, 21 Sep 2023 02:19:53 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 37659C0FAF for ; Thu, 21 Sep 2023 06:19:53 +0000 (UTC) X-FDA: 81259603866.25.A1D7AFF Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by imf08.hostedemail.com (Postfix) with ESMTP id BC82D160004 for ; Thu, 21 Sep 2023 06:19:49 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=Vnuxlz+j; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf08.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.25 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695277190; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:references:dkim-signature; bh=0Zxt+m+/iw1yKBopL/xFUFW5MptDCFQTFwP3AhppyOY=; b=fhTC4+l2Cv7bGZse4HZidkUWlP0sVwdTu5jjk/xnatyczQteQwl+c/5TSR52+/KBawMcsN /uUKeF+ro2OegmtqEun7Jme8D2ISgZpMhRFwMJFdZMg5wpJupOFrXAz1rMxApfzH8JafVT 0IR7PaFu8e0E5nax3UAo3FfmvMF0rMc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=Vnuxlz+j; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf08.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.25 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695277190; a=rsa-sha256; cv=none; b=Mo5tOmYPsb6Y9id9rTJNVs3gCN1SGbkbxFQw/DpBD2TlVst/3Llcegy8vfcuu63yYgPqkA 24r5yJ4QkiylwgXcVnROECnFaJ3dyuU3GCMflaobPTFt8uHxX/t67iWXSLbwa1D/zg9+4L /MtLZI/p9TIrlwMD2EjpAVr1nnz1TSs= Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230921061946epoutp02bd1a413863cb769dd2cd2f3b69e9eb05~G1Z5yzCGj1934619346epoutp02V for ; Thu, 21 Sep 2023 06:19:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230921061946epoutp02bd1a413863cb769dd2cd2f3b69e9eb05~G1Z5yzCGj1934619346epoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1695277186; bh=0Zxt+m+/iw1yKBopL/xFUFW5MptDCFQTFwP3AhppyOY=; h=From:To:Cc:Subject:Date:References:From; b=Vnuxlz+jmYOwJQSN7rTpgDst0u+eLD8N+8a0tqHQIGSvLIk4U2XT1HBbnJ7iq6lDM t309spe8/kFC/XM8PHHWX6HVZCSYWoyU49z7WNbqEzeRZ9DU5mZMvQEEC0WmUZJKPb DSZz85gOLNk+zmlCN8si0gXqJu/IIEWHQuPrjM6E= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20230921061945epcas1p1186d256be4b9d290dda3b1408ac14a35~G1Z5TSyG60965009650epcas1p1t; Thu, 21 Sep 2023 06:19:45 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.36.223]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RrlcK2gdjz4x9Q3; Thu, 21 Sep 2023 06:19:45 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 66.E9.10012.180EB056; Thu, 21 Sep 2023 15:19:45 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230921061944epcas1p2f8a022282709da12840b33c0f5898b5f~G1Z4kfhwH0410304103epcas1p2E; Thu, 21 Sep 2023 06:19:44 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230921061944epsmtrp2ac12d2c49dd394b444e84e6ee537632f~G1Z4jmSC-0762207622epsmtrp29; Thu, 21 Sep 2023 06:19:44 +0000 (GMT) X-AuditID: b6c32a35-50fff7000000271c-91-650be081c968 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 40.02.08742.080EB056; Thu, 21 Sep 2023 15:19:44 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.99]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230921061944epsmtip185f493ca9c43ba7d268ba45508fee6ef~G1Z4YHAxs2652326523epsmtip1W; Thu, 21 Sep 2023 06:19:44 +0000 (GMT) From: Jaewon Kim To: rostedt@goodmis.org, yuzhao@google.com, tjmercier@google.com, kaleshsingh@google.com, akpm@linux-foundation.org, vbabka@suse.cz, hannes@cmpxchg.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 v2] vmscan: add trace events for lru_gen Date: Thu, 21 Sep 2023 15:22:06 +0900 Message-Id: <20230921062206.14429-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNKsWRmVeSWpSXmKPExsWy7bCmnm7jA+5Ug/+NQhZz1q9hs1i9ydei e/NMRove96+YLJr2zWS3uLxrDpvFvTX/WS2OrD/LYrGv4wGTxbv1X9gsZjf2MVq8m/CF1YHH 4/Cb98weO2fdZfdo2XeL3WPBplKPTZ8msXucmPGbxaNvyypGjzMLjrB7fN4kF8AZlW2TkZqY klqkkJqXnJ+SmZduq+QdHO8cb2pmYKhraGlhrqSQl5ibaqvk4hOg65aZA3SxkkJZYk4pUCgg sbhYSd/Opii/tCRVISO/uMRWKbUgJafArECvODG3uDQvXS8vtcTK0MDAyBSoMCE749udNywF fx0rjvZ+Y29gXGbexcjJISFgIjFrxm32LkYuDiGBHYwSB69fgnI+MUqsuL+BGcL5xiixedYc NpiWG69eQlXtZZT48v41I4TznVHi8ebVjCBVbALaEu8XTGIFSYgIzGaUOHvqOwuIwwzivN9w CWyWsICFRPf6/+wgNouAqsTj+dPA4rwCthJvL7xhhtgnL7F6wwEo+yu7xNkmGwjbReLutyWM ELawxKvjW9ghbCmJz+/2Qt2aL3Hh4iumLkYOILtGYuFEQ4iwvcSurzNYQcLMApoS63fpQ4QV J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4FjAyrGCVTC4pz 03OLDQsM81LL9YoTc4tL89L1kvNzNzGCQ1NLcwfj9lUf9A4xMnEwHmKU4GBWEuFN/sSVKsSb klhZlVqUH19UmpNafIhRmoNFSZxX/EVvipBAemJJanZqakFqEUyWiYNTqoFJcqHLrsKXZz79 /tq4oSr2Fc+S1nK9O84F4XouHkb/f2Vt5nnd4hNiYbjpT8kUldvTr0zV4NoYV/GcefKfTI7W eddcykx8jVbfXqD3/V7i3h3x7T394u11RVw33T5O7Aje/oH7aam18B+vTwU8r9pnW4UeCz9e Mlc/3nhDktn1Ezfy5OQDym6v21z/MyFEY6aNtZp2kka3Oh/nXtv6Ze+Ez+gYb7hU8m1upTD7 1ymOl87I8fYdnqk+z6D1YuKWmQcFRRcfY3v5Wm4LN992l8vfZKq3/b1ecNU7ZGWztOn2h/P5 DA6xT50/58Vf48BLJ+1yQ3hs/rzf07Zw0nQeGY9/az8wlh82mVtx4evjgFldSizFGYmGWsxF xYkA6MA8NrwCAAA= X-CMS-MailID: 20230921061944epcas1p2f8a022282709da12840b33c0f5898b5f X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230921061944epcas1p2f8a022282709da12840b33c0f5898b5f References: X-Rspamd-Queue-Id: BC82D160004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: a7eo8qa8xz7sxuzxhqwpjts15dn5u7w5 X-HE-Tag: 1695277189-350690 X-HE-Meta: U2FsdGVkX19p8/Muif5YlpSTyO9JkRVtBQPVUKcIeV1LIlIwijUCsAu+2xnsMjbaW+TB2SNMHns4kxh/pVRwDBmdZ35vnixkTmcByWvx9leMUmvmbFROdHqYYwtz+Q0OYB0kKRq7o/x0nQUu/ZBYGTcPk1JYh/Mb6cERlKyLyJIrU2EhYvqm78N8oe0YS0JrmlC5MynUE9cUwXhEJZ9E0K3FS/iRcdtCPfU5cHmLgy4s3qXf+qMnq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edence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As the legacy lru provides, the lru_gen needs some trace events for debugging. This commit introduces 2 trace events. trace_mm_vmscan_lru_gen_scan trace_mm_vmscan_lru_gen_evict Each event is similar to the following legacy events. trace_mm_vmscan_lru_isolate, trace_mm_vmscan_lru_shrink_[in]active Here's an example mm_vmscan_lru_gen_scan: isolate_mode=0 classzone=1 order=9 nr_requested=4096 nr_scanned=431 nr_skipped=0 nr_taken=55 lru=anon mm_vmscan_lru_gen_evict: nid=0 nr_reclaimed=42 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=13 nr_activate_file=0 nr_ref_keep=0 nr_unmap_fail=0 priority=2 flags=RECLAIM_WB_ANON|RECLAIM_WB_ASYNC mm_vmscan_lru_gen_scan: isolate_mode=0 classzone=1 order=9 nr_requested=4096 nr_scanned=66 nr_skipped=0 nr_taken=64 lru=file mm_vmscan_lru_gen_evict: nid=0 nr_reclaimed=62 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=2 nr_ref_keep=0 nr_unmap_fail=0 priority=2 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC Signed-off-by: Jaewon Kim Reviewed-by: Steven Rostedt (Google) Reviewed-by: T.J. Mercier --- v2: use condition and make it aligned v1: introduce trace events --- include/trace/events/mmflags.h | 5 ++ include/trace/events/vmscan.h | 98 ++++++++++++++++++++++++++++++++++ mm/vmscan.c | 17 ++++-- 3 files changed, 115 insertions(+), 5 deletions(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 1478b9dd05fa..44e9b38f83e7 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -274,6 +274,10 @@ IF_HAVE_VM_SOFTDIRTY(VM_SOFTDIRTY, "softdirty" ) \ EM (LRU_ACTIVE_FILE, "active_file") \ EMe(LRU_UNEVICTABLE, "unevictable") +#define LRU_GEN_NAMES \ + EM (LRU_GEN_ANON, "anon") \ + EMe(LRU_GEN_FILE, "file") + /* * First define the enums in the above macros to be exported to userspace * via TRACE_DEFINE_ENUM(). @@ -288,6 +292,7 @@ COMPACTION_PRIORITY /* COMPACTION_FEEDBACK are defines not enums. Not needed here. */ ZONE_TYPE LRU_NAMES +LRU_GEN_NAMES /* * Now redefine the EM() and EMe() macros to map the enums to the strings diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index d2123dd960d5..f0c3a4bd72db 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -327,6 +327,57 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __print_symbolic(__entry->lru, LRU_NAMES)) ); +TRACE_EVENT_CONDITION(mm_vmscan_lru_gen_scan, + TP_PROTO(int highest_zoneidx, + int order, + unsigned long nr_requested, + unsigned long nr_scanned, + unsigned long nr_skipped, + unsigned long nr_taken, + isolate_mode_t isolate_mode, + int lru), + + TP_ARGS(highest_zoneidx, order, nr_requested, nr_scanned, nr_skipped, nr_taken, isolate_mode, lru), + + TP_CONDITION(nr_scanned), + + TP_STRUCT__entry( + __field(int, highest_zoneidx) + __field(int, order) + __field(unsigned long, nr_requested) + __field(unsigned long, nr_scanned) + __field(unsigned long, nr_skipped) + __field(unsigned long, nr_taken) + __field(unsigned int, isolate_mode) + __field(int, lru) + ), + + TP_fast_assign( + __entry->highest_zoneidx = highest_zoneidx; + __entry->order = order; + __entry->nr_requested = nr_requested; + __entry->nr_scanned = nr_scanned; + __entry->nr_skipped = nr_skipped; + __entry->nr_taken = nr_taken; + __entry->isolate_mode = (__force unsigned int)isolate_mode; + __entry->lru = lru; + ), + + /* + * classzone is previous name of the highest_zoneidx. + * Reason not to change it is the ABI requirement of the tracepoint. + */ + TP_printk("isolate_mode=%d classzone=%d order=%d nr_requested=%lu nr_scanned=%lu nr_skipped=%lu nr_taken=%lu lru=%s", + __entry->isolate_mode, + __entry->highest_zoneidx, + __entry->order, + __entry->nr_requested, + __entry->nr_scanned, + __entry->nr_skipped, + __entry->nr_taken, + __print_symbolic(__entry->lru, LRU_GEN_NAMES)) +); + TRACE_EVENT(mm_vmscan_write_folio, TP_PROTO(struct folio *folio), @@ -437,6 +488,53 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active, show_reclaim_flags(__entry->reclaim_flags)) ); +TRACE_EVENT(mm_vmscan_lru_gen_evict, + + TP_PROTO(int nid, unsigned long nr_reclaimed, + struct reclaim_stat *stat, int priority, int file), + + TP_ARGS(nid, nr_reclaimed, stat, priority, file), + + TP_STRUCT__entry( + __field(unsigned long, nr_reclaimed) + __field(unsigned long, nr_dirty) + __field(unsigned long, nr_writeback) + __field(unsigned long, nr_congested) + __field(unsigned long, nr_immediate) + __field(unsigned int, nr_activate0) + __field(unsigned int, nr_activate1) + __field(unsigned long, nr_ref_keep) + __field(unsigned long, nr_unmap_fail) + __field(int, nid) + __field(int, priority) + __field(int, reclaim_flags) + ), + + TP_fast_assign( + __entry->nid = nid; + __entry->nr_reclaimed = nr_reclaimed; + __entry->nr_dirty = stat->nr_dirty; + __entry->nr_writeback = stat->nr_writeback; + __entry->nr_congested = stat->nr_congested; + __entry->nr_immediate = stat->nr_immediate; + __entry->nr_activate0 = stat->nr_activate[0]; + __entry->nr_activate1 = stat->nr_activate[1]; + __entry->nr_ref_keep = stat->nr_ref_keep; + __entry->nr_unmap_fail = stat->nr_unmap_fail; + __entry->priority = priority; + __entry->reclaim_flags = trace_reclaim_flags(file); + ), + + TP_printk("nid=%d nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s", + __entry->nid, __entry->nr_reclaimed, + __entry->nr_dirty, __entry->nr_writeback, + __entry->nr_congested, __entry->nr_immediate, + __entry->nr_activate0, __entry->nr_activate1, + __entry->nr_ref_keep, __entry->nr_unmap_fail, + __entry->priority, + show_reclaim_flags(__entry->reclaim_flags)) +); + TRACE_EVENT(mm_vmscan_node_reclaim_begin, TP_PROTO(int nid, int order, gfp_t gfp_flags), diff --git a/mm/vmscan.c b/mm/vmscan.c index 6f13394b112e..f453a0f8ceef 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) @@ -5065,6 +5067,9 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, __count_memcg_events(memcg, PGREFILL, sorted); __count_vm_events(PGSCAN_ANON + type, isolated); + trace_mm_vmscan_lru_gen_scan(sc->reclaim_idx, sc->order, MAX_LRU_BATCH, + scanned, skipped, isolated, + sc->may_unmap ? 0 : ISOLATE_UNMAPPED, type); /* * There might not be eligible folios due to reclaim_idx. Check the * remaining to prevent livelock if it's not making progress. @@ -5194,6 +5199,8 @@ 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_gen_evict(pgdat->node_id, reclaimed, &stat, + sc->priority, type); list_for_each_entry_safe_reverse(folio, next, &list, lru) { if (!folio_evictable(folio)) {