linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	akpm@linux-foundation.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"K . Prasad" <prasad@linux.vnet.ibm.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	rostedt@goodmis.org, Alexei Starovoitov <ast@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Ingo Molnar <mingo@redhat.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: [RFC PATCH 3/9] writeback: tracing: pass global_wb_domain as tracepoint parameter
Date: Thu,  9 Apr 2020 15:35:37 -0400	[thread overview]
Message-ID: <20200409193543.18115-4-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200409193543.18115-1-mathieu.desnoyers@efficios.com>

The symbol global_wb_domain is not GPL-exported to modules. In order
to allow kernel tracers implemented as GPL modules to access the
global writeback domain dirty limit, as used within the
global_dirty_state and balance_dirty_pages trace events, pass
a pointer to the global writeback domain as a new parameter for
those tracepoints.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 include/trace/events/writeback.h | 17 ++++++++++-------
 mm/page-writeback.c              |  9 +++++----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index d94def25e4dc..8fd774108c9c 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -531,11 +531,13 @@ TRACE_EVENT(writeback_queue_io,
 
 TRACE_EVENT(global_dirty_state,
 
-	TP_PROTO(unsigned long background_thresh,
+	TP_PROTO(struct wb_domain *domain,
+		 unsigned long background_thresh,
 		 unsigned long dirty_thresh
 	),
 
-	TP_ARGS(background_thresh,
+	TP_ARGS(domain,
+		background_thresh,
 		dirty_thresh
 	),
 
@@ -558,7 +560,7 @@ TRACE_EVENT(global_dirty_state,
 		__entry->nr_written	= global_node_page_state(NR_WRITTEN);
 		__entry->background_thresh = background_thresh;
 		__entry->dirty_thresh	= dirty_thresh;
-		__entry->dirty_limit	= global_wb_domain.dirty_limit;
+		__entry->dirty_limit	= domain->dirty_limit;
 	),
 
 	TP_printk("dirty=%lu writeback=%lu unstable=%lu "
@@ -625,7 +627,8 @@ TRACE_EVENT(bdi_dirty_ratelimit,
 
 TRACE_EVENT(balance_dirty_pages,
 
-	TP_PROTO(struct bdi_writeback *wb,
+	TP_PROTO(struct wb_domain *domain,
+		 struct bdi_writeback *wb,
 		 unsigned long thresh,
 		 unsigned long bg_thresh,
 		 unsigned long dirty,
@@ -638,7 +641,7 @@ TRACE_EVENT(balance_dirty_pages,
 		 long pause,
 		 unsigned long start_time),
 
-	TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
+	TP_ARGS(domain, wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
 		dirty_ratelimit, task_ratelimit,
 		dirtied, period, pause, start_time),
 
@@ -664,8 +667,8 @@ TRACE_EVENT(balance_dirty_pages,
 		unsigned long freerun = (thresh + bg_thresh) / 2;
 		strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32);
 
-		__entry->limit		= global_wb_domain.dirty_limit;
-		__entry->setpoint	= (global_wb_domain.dirty_limit +
+		__entry->limit		= domain->dirty_limit;
+		__entry->setpoint	= (domain->dirty_limit +
 						freerun) / 2;
 		__entry->dirty		= dirty;
 		__entry->bdi_setpoint	= __entry->setpoint *
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7326b54ab728..c76aae305360 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -443,9 +443,8 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc)
 	dtc->thresh = thresh;
 	dtc->bg_thresh = bg_thresh;
 
-	/* we should eventually report the domain in the TP */
 	if (!gdtc)
-		trace_global_dirty_state(bg_thresh, thresh);
+		trace_global_dirty_state(&global_wb_domain, bg_thresh, thresh);
 }
 
 /**
@@ -1736,7 +1735,8 @@ static void balance_dirty_pages(struct bdi_writeback *wb,
 		 * do a reset, as it may be a light dirtier.
 		 */
 		if (pause < min_pause) {
-			trace_balance_dirty_pages(wb,
+			trace_balance_dirty_pages(&global_wb_domain,
+						  wb,
 						  sdtc->thresh,
 						  sdtc->bg_thresh,
 						  sdtc->dirty,
@@ -1765,7 +1765,8 @@ static void balance_dirty_pages(struct bdi_writeback *wb,
 		}
 
 pause:
-		trace_balance_dirty_pages(wb,
+		trace_balance_dirty_pages(&global_wb_domain,
+					  wb,
 					  sdtc->thresh,
 					  sdtc->bg_thresh,
 					  sdtc->dirty,
-- 
2.17.1


  parent reply	other threads:[~2020-04-09 19:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 19:35 [RFC PATCH 0/9] Export information needed by the LTTng kernel tracer Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 1/9] tracepoint: call vmalloc_sync_mappings() on registration Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 2/9] bpf: allow up to 13 arguments for tracepoints Mathieu Desnoyers
2020-04-09 19:35 ` Mathieu Desnoyers [this message]
2020-04-09 22:33   ` [RFC PATCH 3/9] writeback: tracing: pass global_wb_domain as tracepoint parameter Alexei Starovoitov
2020-04-10 11:54     ` Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 4/9] stacktrace: export-GPL stack_trace_save_user Mathieu Desnoyers
2020-04-12  8:31   ` Christoph Hellwig
2020-04-09 19:35 ` [RFC PATCH 5/9] sched: export-GPL task_prio Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 6/9] mm: export-GPL get_pageblock_migratetype Mathieu Desnoyers
2020-04-12  8:14   ` Christoph Hellwig
2020-04-09 19:35 ` [RFC PATCH 7/9] block: genhd: export-GPL gendisk_name Mathieu Desnoyers
2020-04-09 19:35 ` [RFC PATCH 8/9] block: genhd: export-GPL generic disk device type Mathieu Desnoyers
2020-04-10  6:33   ` Greg Kroah-Hartman
2020-04-10 13:31     ` Mathieu Desnoyers
2020-04-10 15:44     ` Steven Rostedt
2020-04-11  6:45       ` Greg Kroah-Hartman
2020-04-09 19:35 ` [RFC PATCH 9/9] block: genhd: export-GPL generic disk block class Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409193543.18115-4-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).