From patchwork Sun Sep 24 14:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 13396982 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 69DC6CE7A8B for ; Sun, 24 Sep 2023 14:21:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C353A6B020A; Sun, 24 Sep 2023 10:21:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE4AD6B020B; Sun, 24 Sep 2023 10:21:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAC746B020C; Sun, 24 Sep 2023 10:21:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9C7386B020A for ; Sun, 24 Sep 2023 10:21:39 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6A7B31603E8 for ; Sun, 24 Sep 2023 14:21:39 +0000 (UTC) X-FDA: 81271704318.05.B0FF67E Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by imf03.hostedemail.com (Postfix) with ESMTP id 01CBE20002 for ; Sun, 24 Sep 2023 14:21:35 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=QCxcniaq; spf=pass (imf03.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.25 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695565297; a=rsa-sha256; cv=none; b=kqR+8VYCbnhMllN38j6Jfka9ytcP8vD0GIqIWFf6xOjMpsvFzEEwd0bccnYiKnU9d7vGzi GsM85xxAcX7CGzu0Ltg8m0HWk3wjPlr0O/w7GiumdrEI5sh90Lf2Grfw4agPFtvqM3TAQR QcN12viI7/giRdGxKH/VutdnBvNLfF0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=QCxcniaq; spf=pass (imf03.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.25 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695565297; 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=QEicMqNuN7bn1MHkfHwxbR0eP3CwvKShNFQ9U6xbf7M=; b=0h4qEw/3YBAh40ZSm22LqpnQHM99M/CnRHxXrECtVXD0MeVvVGHan4nJY1VptiuWvfneZ3 sqtmKiZQPiEf3Rp9zrFtNun66n5CAAU2rkN8+/+CUquoVBZoWSzdFZPyZX4o1COYlK21a8 qcSOrxe++Wuigqk8LRn6R7uB14qERyo= Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230924142132epoutp020c91187ecbf416f47ff86c9c75c893f9~H26ZQSaMv0380803808epoutp02a for ; Sun, 24 Sep 2023 14:21:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230924142132epoutp020c91187ecbf416f47ff86c9c75c893f9~H26ZQSaMv0380803808epoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1695565292; bh=QEicMqNuN7bn1MHkfHwxbR0eP3CwvKShNFQ9U6xbf7M=; h=From:To:Cc:Subject:Date:References:From; b=QCxcniaqvnVxWXNfLdYewz/oYi3XIjmrHr/xqIrmYO1YvVe+0jeNmwKGC0EY8e7Vo 7mWQVL1iAM503YRsuCH0UUNa9PJu/MCgxY9eUVZWNOxUqVyFTbd9wEAIJ23YyG/JE0 ///IUsuzOjiujOut+GSoman/LH1/eiGll0tLrDmU= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20230924142130epcas1p1967142e4e4ae215dabdd76ed3162d9de~H26XxHsQ72010920109epcas1p1a; Sun, 24 Sep 2023 14:21:30 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.38.248]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Rtp8p0nNvz4x9Pp; Sun, 24 Sep 2023 14:21:30 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 78.C4.10012.9E540156; Sun, 24 Sep 2023 23:21:29 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20230924142129epcas1p4ae9161f7c20ea16408ccc8296f81104a~H26W29b351672216722epcas1p4H; Sun, 24 Sep 2023 14:21:29 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230924142129epsmtrp2a4efbcf4dc5dc390a40927e0fbfd1da2~H26WzgAkn3064130641epsmtrp2U; Sun, 24 Sep 2023 14:21:29 +0000 (GMT) X-AuditID: b6c32a35-50fff7000000271c-35-651045e9209c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B8.F1.08742.9E540156; Sun, 24 Sep 2023 23:21:29 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.99]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230924142129epsmtip1adf6efda46856bb91c6d469237aaa95a~H26WgvZca0839008390epsmtip1R; Sun, 24 Sep 2023 14:21:29 +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 Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH v3] vmscan: add trace events for lru_gen Date: Sun, 24 Sep 2023 23:23:43 +0900 Message-Id: <20230924142343.23924-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNKsWRmVeSWpSXmKPExsWy7bCmvu5LV4FUgy+HLSzmrF/DZrF6k69F 9+aZjBa9718xWTTtm8lucXnXHDaLe2v+s1ocWX+WxWJfxwMmi3frv7BZzG7sY7R4N+ELqwOP x+E375k9ds66y+7Rsu8Wu8eCTaUemz5NYvc4MeM3i0ffllWMHmcWHGH3+LxJLoAzKtsmIzUx JbVIITUvOT8lMy/dVsk7ON453tTMwFDX0NLCXEkhLzE31VbJxSdA1y0zB+hiJYWyxJxSoFBA YnGxkr6dTVF+aUmqQkZ+cYmtUmpBSk6BWYFecWJucWleul5eaomVoYGBkSlQYUJ2RveVSawF rc4V3y80MDUwzrPoYuTkkBAwkdi3chlTFyMXh5DADkaJg5v3MEM4nxglJt79xAbhfGOUWL2x nwWm5d7501AtexklWroaoaq+M0oseHOJGaSKTUBb4v2CSawgCRGB2YwSr3Z8YQRxmEGc9xsu sYFUCQtYSKxfc5cRxGYRUJXYvngXUAcHB6+ArcStF5UQ6+QlVm84AHaUhMBHdonJ9zdA3eEi 8f3/OWYIW1ji1fEt7BC2lMTnd3vZIOx8iQsXXzGBzJQQqJFYONEQImwvsevrDLBVzAKaEut3 6UOEFSV2/p4Ldg2zAJ/Eu689rBCdvBIdbUIQJWoSLc++skLYMhJ//z2Dsj0kLnYuBVsqJBAr cfX/Q+YJjLKzEBYsYGRcxSiWWlCcm55abFhgCI+l5PzcTYzgVKhluoNx4tsPeocYmTgYDzFK cDArifD+esaXKsSbklhZlVqUH19UmpNafIjRFBhaE5mlRJPzgck4ryTe0MTSwMTMyMTC2NLY TEmcl/lRb4qQQHpiSWp2ampBahFMHxMHp1QD0wX3l8ZOzPsFX/G43rTep5OwhXeKjv8yo1+7 W+KnMDKHJJ7TLV5S0F/GKqF+/sQOtTLr+wksNc1u76YFpq9IkZqdsPszdx3fmgfc6rkK8iv/ LalyzwkIKlngPUlv/t7VG65lm33eZRO6OKBBvz1FryXj8d0n0od4zI7oTEmby/F33+0Hn1Im RH9dvY5r6QyDuQv4Di/xjpximxo8sUXohY+7ov9m1+aFPbzh/ySOxM7m0/y1wluru7Yj5MA8 K3uT6VMSBabIbijI2nLO/n+y1OnuVVIMNbJrj0xu4C2YnmmQrHqmz3e588mod4wvDC8ZrokN yCkNNKubzvj5Wy1HaErByo1pRb7fXaWmf1mixFKckWioxVxUnAgAvmV7/A4EAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsWy7bCSnO5LV4FUgw2r+S3mrF/DZrF6k69F 9+aZjBa9718xWTTtm8lucXnXHDaLe2v+s1ocWX+WxWJfxwMmi3frv7BZzG7sY7R4N+ELqwOP x+E375k9ds66y+7Rsu8Wu8eCTaUemz5NYvc4MeM3i0ffllWMHmcWHGH3+LxJLoAzissmJTUn syy1SN8ugSuj+8ok1oJW54rvFxqYGhjnWXQxcnJICJhI3Dt/mqmLkYtDSGA3o8Tb3a2MEAkZ iTfnn7J0MXIA2cIShw8XQ9R8ZZQ49uEwWA2bgLbE+wWTWEESIgKLGSUuvZkDlmAWmM8o8WBK AIgtLGAhsX7NXbA4i4CqxPbFu1hBhvIK2ErcelEJsUteYvWGA8wTGHkWMDKsYpRMLSjOTc8t NiwwzEst1ytOzC0uzUvXS87P3cQIDk0tzR2M21d90DvEyMTBeIhRgoNZSYT31zO+VCHelMTK qtSi/Pii0pzU4kOM0hwsSuK84i96U4QE0hNLUrNTUwtSi2CyTBycUg1MB7/t/ri1+rzXszfq l4zud2fdqrAIyHCOUqwTWiOaEVIWWvDOY32n8udibj5nr54v1zftF89nuhV20e90XJcWR+Sh rc1P7S0mv9pU6fXl4yXl9MRwJ50n7H/WvlI51bi24hNrV94phm6R/J3by/cEaKoczXF3sd34 Zo2/bEKRo9la57I11xatZQ1W2Wf++W+xSLqFTcfG9i4P5fIVywrT+dkrPbyfRc9+9LQ+O/36 I9YtJdFHinXX+K4+XG6WL1++QUOKb5dpuIRIRMWPle9KXswSecl3/6wbl2hX8MYLlwo4mxL8 Go8eTxKSvl1/3UcjVnLRlfm75l5+vM7k6NT61wrJzj7xyWlacl1PfyuxFGckGmoxFxUnAgAi 0LymvAIAAA== X-CMS-MailID: 20230924142129epcas1p4ae9161f7c20ea16408ccc8296f81104a X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230924142129epcas1p4ae9161f7c20ea16408ccc8296f81104a References: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 01CBE20002 X-Stat-Signature: dpfe9ncb3ugkb8pub1ysio8jmnp3d6id X-Rspam-User: X-HE-Tag: 1695565295-334670 X-HE-Meta: U2FsdGVkX1/eOL+CZIxgnFonRAOHrD/1nyxDWhJ9mMmpQrfe09eK0ZrHE1HR5NcxdAs/E5Oy/wBwi/7qLB3RdO/RSzVSryCvirV4TFkdn0ywDyzPAmo+5OZcqKN4G35TqObltxFbfIJ8ON13S5qWSxk8d3RjJBzPEOBp1yDhhv1VT062sKdx0K5f7ftKSoJ8kD3nkT6cB6ONP2HFsVlDrnTiUC2cJFBkKF0G3YVdEMfxHslJxAS3hgb1B4zk/FqtazzKMD5QDmuPzt7K58hq/vbOzEJhg85bDoK65oNHe+NBgAANwlEEXIlWMpWB6ppc1zC28xZD2DRbY/UIoJ27UcJh8F/NzlvUPK/W6n5scLwkom/gSjJgALe8WgaEN+djnYeT7B57lu4E2sWG1LltxQfFdSD+btQQq+fyjNhaFQlRbxUVU28xG46YaGdVzYXU4CaSFfWJiqBQEm4WS31UCp89ZlDlhtpAj/55ysR+K33Kpasryxtm73oqXVWsujZrIG2dgbde+3fzB+vGv/WMG/jmdFBfpc1Jp9arlJVBX3qcVSUVaL/43ui++pmfafu6d2XmaKHZ6P4sCscvx+Rcn+dyVjlRqiAfySxsfsODWZT5lddN1J8xD0LNdJ6VxZ1l27Hz7SxD3/xVe6W0ZzK8qTwaDlpt0DER8Zt7ODAcXU83BvGbFzSrq0Rcupr29Nj7yS9p/UQ8untilcQikD+KBjMjQMv9wlld1THaLOFM5hPBhNj8JyTPAmkFF3GgMlEqIObvPtuHuZuJVKAUI99W3nQlq7FnJcZKG8pbc35WnCz8K4FWIcGJC7VtwVq2Aa7/dDajkLIyHyTe6z7+6V/LX5N4ZhMKxYpJS9+ZCQJZXp+Kj6up45lQQ2ndnvT9rfJ9fyy4QsilmdUrRzQg4wJkzTKc7zsVtVeaB8h6fWx3Xi2Z8ydpmtEFLxp60vlnjiEqqSPCbKWRumQyG/l9KB7 tSHD2UUh P/ehEmUdkn1lY5prpWNVYF01D99DnQzd/l+7DIbJkx/nVg9o0OgjvqdcyJk7ASf3F2OHpodE3gCVRzLL1IJyQnp9z+7j5qGdafRAxJA5dIEulMk3bjVi0tUCa/HZzNz4rE45N3s6U9BMJoSq6AknN05ms74P1RnCM1NH3OAlrV4BhvWcRN+dU0bSFDox6m1ARuRRi3tAY1bG/NxS8xQflPjMyDSIQpSmAoqfbJqpzsgVyfUQ5JXjdXKBBhhI5yz2TjEv3 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: 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 --- v3: change printk format 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..12eee5558016 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=%u 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=%lu nr_dirty=%lu nr_writeback=%lu nr_congested=%lu nr_immediate=%lu nr_activate_anon=%u nr_activate_file=%u nr_ref_keep=%lu nr_unmap_fail=%lu 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)) {