Message ID | 20240214170157.17530-7-osalvador@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1356070dyb; Wed, 14 Feb 2024 09:03:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXeGLdFze8sUei00pZmXB6lwWd6WP1w1XE7q1EL31bUt/IGrKWZN0QBi6/vvOlmX21pEBNA8Nm+F+YGKzhO8pifydWJqA== X-Google-Smtp-Source: AGHT+IElxZIQaucECkBRrLYtFRbLXrqXzM5csaM6MgaCz0EB5HKzNIJa+p192ZneGl/4UcmS6Kyb X-Received: by 2002:a17:906:d8d7:b0:a3d:5dc7:5b9e with SMTP id re23-20020a170906d8d700b00a3d5dc75b9emr1209999ejb.15.1707930195891; Wed, 14 Feb 2024 09:03:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707930195; cv=pass; d=google.com; s=arc-20160816; b=AdDberGb1+z77peREVY3NBSap15RElDDuNZWTENfm5ZOsIp9wqWoqBJGAaofDRb2at yeGycAXa/2MdvA0EWfCGWk+BLQ7FXFf95iVptDDt4h6JiI3GhOqULB80Kz9H1Ryosm8R IFt5LQNByNkNKm7UIW5X2yzdHb0hBOYMcVrrCNEQLqro5AOASK3MMHIXOUiB+WjYGtYO vu3LsNZCnmPirZii/m4agcafh/vFnRbavdCRtALTtdM60we8PMcHnOoWgmpQnW00U6pY 9AxJ0uoY+cxtaUvM/PzomFlw+qeI0Di6Sfx02xaFnysBNzC3OLk4myghmRgr5fzHxhYl SRKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=O95gSBj24arVN2KSdkLlOTusRHAm3etcuM3qAIyUVjc=; fh=dyDmwPwgN+1gAJtaZ0UyIbU8cE/yjMvwZNYPlS09NB4=; b=WYcz2Xim62cGSNIi5aFsKcmB3zheoWZGZhgdBgPB95EdoLK2DQA8R61zPZjhkiR56t ueLYpQVCQawpSoWBAq/0Cfgn5N4HaS8n2DRS0oizqBIvtKPMbhs0miAjzbiGNtH1zqtb OlJuE0mHzm8cx7Ty6M0NiJGo98WGW4Wzl86FGT0nq0tckzfSNg4Ilc0RzJY4cLQYiOuP RzJ2at3EjiaJ8yWRI2mr4LptdXSeS5MkBrORNI6MbE6toAjFHiei/1QwpSX/LKwCn7Ww F/fduHKFJye8kvkPpmz4mzoffe2pN8OKfHxegRz6nkjtPi5uJ1WDsDo5X3XXo07xyjYC SXFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zes+YGlv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zes+YGlv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=2; AJvYcCUJL5qhmgkJNpl6VmcHiaQIamOzQM8fq2z9UBLBw05/njM3jFaK0LOZdPy3M0ymjEPXi4WleKdoGUpPzPrCBaJg3M6PJg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jg22-20020a170907971600b00a3d38347df5si940841ejc.1048.2024.02.14.09.03.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 09:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zes+YGlv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zes+YGlv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65607-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 588561F219FE for <ouuuleilei@gmail.com>; Wed, 14 Feb 2024 17:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 462BC63120; Wed, 14 Feb 2024 17:01:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="zes+YGlv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="86Scdmj0"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="zes+YGlv"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="86Scdmj0" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B93A260EC9 for <linux-kernel@vger.kernel.org>; Wed, 14 Feb 2024 17:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707930064; cv=none; b=qooR67bEb4q6Y46+LIWlBvbZMWejM/D+Xtp219zRIDd7tbQCwsmvRDpIuboN7tAiY+DVuPjbKF2T5yqV7jwW7bjK8ukA4S60IDucflEgXp3BunB3phlHoR3+4ZEzE8FW/O2k9AfEYG4BRBwigoLZhxlBsuzTZcqJYbsLrV67k0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707930064; c=relaxed/simple; bh=MI+IeJmRaq86MzICTxaBZ0taBv1e4Xxijj8xZfxYDLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mYUzPFiCDj24H0FtcuF0E5JO57luiDzHqzryymjFZSYHY84FuKxdIvXDr1b+rlmICPJ8Jix+4U+8pMN5sgqZMR+L7Ihgh6b2oG2JLMlMVadPdsaeTfB1s3ZY0O/h85S2eOtlCuCJGwmUsWiPaCQRRVclVO4OKfAB/lOX7rMF2hM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=zes+YGlv; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=86Scdmj0; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=zes+YGlv; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=86Scdmj0; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 021331FD29; Wed, 14 Feb 2024 17:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707930060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O95gSBj24arVN2KSdkLlOTusRHAm3etcuM3qAIyUVjc=; b=zes+YGlvv/bao0zBIXw9Zxr3DdFVNNTRtDV+b2DD6ZqBt31dljhlZLxxPY6JnRnX/dH7Xv lEAx+JMFrM4BvoMIy5uOjmUu716LBBjYkxy3CFeOGWBCNZNDaErMrY7hpTM+OPtX0ZDRUY f2rmdN5751tBiBl7y/ifA6uZR7yZV0A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707930060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O95gSBj24arVN2KSdkLlOTusRHAm3etcuM3qAIyUVjc=; b=86Scdmj0zPg4HuR75wAYrOc+P1+yRbV5BQV4UvtPgV/1ChGWvJVWeFILHJ7iJDt92UFN0g gTkTbDvL+T/TvACA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707930060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O95gSBj24arVN2KSdkLlOTusRHAm3etcuM3qAIyUVjc=; b=zes+YGlvv/bao0zBIXw9Zxr3DdFVNNTRtDV+b2DD6ZqBt31dljhlZLxxPY6JnRnX/dH7Xv lEAx+JMFrM4BvoMIy5uOjmUu716LBBjYkxy3CFeOGWBCNZNDaErMrY7hpTM+OPtX0ZDRUY f2rmdN5751tBiBl7y/ifA6uZR7yZV0A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707930060; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O95gSBj24arVN2KSdkLlOTusRHAm3etcuM3qAIyUVjc=; b=86Scdmj0zPg4HuR75wAYrOc+P1+yRbV5BQV4UvtPgV/1ChGWvJVWeFILHJ7iJDt92UFN0g gTkTbDvL+T/TvACA== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 7536B13A0B; Wed, 14 Feb 2024 17:00:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id MFb7GcvxzGUfMwAAn2gu4w (envelope-from <osalvador@suse.de>); Wed, 14 Feb 2024 17:00:59 +0000 From: Oscar Salvador <osalvador@suse.de> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>, Marco Elver <elver@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Alexander Potapenko <glider@google.com>, Oscar Salvador <osalvador@suse.de> Subject: [PATCH v9 6/7] mm,page_owner: Filter out stacks by a threshold Date: Wed, 14 Feb 2024 18:01:56 +0100 Message-ID: <20240214170157.17530-7-osalvador@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214170157.17530-1-osalvador@suse.de> References: <20240214170157.17530-1-osalvador@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [3.36 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[9]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[vger.kernel.org,kvack.org,suse.com,suse.cz,google.com,gmail.com,suse.de]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.54)[91.97%] X-Spam-Level: *** X-Spam-Score: 3.36 X-Spam-Flag: NO X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790894612934342329 X-GMAIL-MSGID: 1790894612934342329 |
Series |
page_owner: print stacks and their outstanding allocations
|
|
Commit Message
Oscar Salvador
Feb. 14, 2024, 5:01 p.m. UTC
We want to be able to filter out the stacks based on a threshold we can
can tune.
By writing to 'count_threshold' file, we can adjust the threshold value.
Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
mm/page_owner.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
Comments
On 2/14/24 18:01, Oscar Salvador wrote: > We want to be able to filter out the stacks based on a threshold we can > can tune. > By writing to 'count_threshold' file, we can adjust the threshold value. > > Signed-off-by: Oscar Salvador <osalvador@suse.de> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> .. > --- > mm/page_owner.c | 29 +++++++++++++++++++++++++---- > 1 file changed, 25 insertions(+), 4 deletions(-) > > diff --git a/mm/page_owner.c b/mm/page_owner.c > index 5258a417f4d1..9b975f59b773 100644 > --- a/mm/page_owner.c > +++ b/mm/page_owner.c > @@ -846,9 +846,11 @@ static void *stack_next(struct seq_file *m, void *v, loff_t *ppos) > return stack; > } > > +static unsigned long page_owner_stack_threshold; > + > static int stack_print(struct seq_file *m, void *v) > { > - int i; > + int i, stack_count; > struct stack *stack = v; > unsigned long *entries; > unsigned long nr_entries; > @@ -856,14 +858,15 @@ static int stack_print(struct seq_file *m, void *v) > > nr_entries = stack_record->size; > entries = stack_record->entries; > + stack_count = refcount_read(&stack_record->count); Again "- 1" here. > - if (!nr_entries || nr_entries < 0 || > - refcount_read(&stack_record->count) < 2) > + if (!nr_entries || nr_entries < 0 || stack_count < 2 || > + stack_count < page_owner_stack_threshold) Which will also correct the comparison. > return 0; > > for (i = 0; i < nr_entries; i++) > seq_printf(m, " %pS\n", (void *)entries[i]); > - seq_printf(m, "stack_count: %d\n\n", refcount_read(&stack_record->count)); > + seq_printf(m, "stack_count: %d\n\n", stack_count); And no - 1 needed here then.
On Thu, Feb 15, 2024 at 12:12:56PM +0100, Vlastimil Babka wrote: > On 2/14/24 18:01, Oscar Salvador wrote: > > We want to be able to filter out the stacks based on a threshold we can > > can tune. > > By writing to 'count_threshold' file, we can adjust the threshold value. > > > > Signed-off-by: Oscar Salvador <osalvador@suse.de> > > Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Thanks > Again "- 1" here. Yes, I might just instead add this assigment in the previous patch, so no further modifications wrt. stack_count will be needed in this patch. Might be cleaner?
diff --git a/mm/page_owner.c b/mm/page_owner.c index 5258a417f4d1..9b975f59b773 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -846,9 +846,11 @@ static void *stack_next(struct seq_file *m, void *v, loff_t *ppos) return stack; } +static unsigned long page_owner_stack_threshold; + static int stack_print(struct seq_file *m, void *v) { - int i; + int i, stack_count; struct stack *stack = v; unsigned long *entries; unsigned long nr_entries; @@ -856,14 +858,15 @@ static int stack_print(struct seq_file *m, void *v) nr_entries = stack_record->size; entries = stack_record->entries; + stack_count = refcount_read(&stack_record->count); - if (!nr_entries || nr_entries < 0 || - refcount_read(&stack_record->count) < 2) + if (!nr_entries || nr_entries < 0 || stack_count < 2 || + stack_count < page_owner_stack_threshold) return 0; for (i = 0; i < nr_entries; i++) seq_printf(m, " %pS\n", (void *)entries[i]); - seq_printf(m, "stack_count: %d\n\n", refcount_read(&stack_record->count)); + seq_printf(m, "stack_count: %d\n\n", stack_count); return 0; } @@ -891,6 +894,22 @@ static const struct file_operations page_owner_stack_operations = { .release = seq_release, }; +static int page_owner_threshold_get(void *data, u64 *val) +{ + *val = READ_ONCE(page_owner_stack_threshold); + return 0; +} + +static int page_owner_threshold_set(void *data, u64 val) +{ + WRITE_ONCE(page_owner_stack_threshold, val); + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(proc_page_owner_threshold, &page_owner_threshold_get, + &page_owner_threshold_set, "%llu"); + + static int __init pageowner_init(void) { struct dentry *dir; @@ -905,6 +924,8 @@ static int __init pageowner_init(void) dir = debugfs_create_dir("page_owner_stacks", NULL); debugfs_create_file("show_stacks", 0400, dir, NULL, &page_owner_stack_operations); + debugfs_create_file("count_threshold", 0600, dir, NULL, + &proc_page_owner_threshold); return 0; }