linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Tang Yizhou <yizhou.tang@shopee.com>
Cc: tj@kernel.org, jack@suse.cz, brauner@kernel.org,
	willy@infradead.org, akpm@linux-foundation.org,
	mhiramat@kernel.org, ast@kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] writeback: Let trace_balance_dirty_pages() take struct dtc as parameter
Date: Tue, 4 Mar 2025 10:39:57 -0500	[thread overview]
Message-ID: <20250304103957.08c79da0@gandalf.local.home> (raw)
In-Reply-To: <20250304110318.159567-2-yizhou.tang@shopee.com>

On Tue,  4 Mar 2025 19:03:16 +0800
Tang Yizhou <yizhou.tang@shopee.com> wrote:

> @@ -664,16 +660,16 @@ TRACE_EVENT(balance_dirty_pages,
>  	),
>  
>  	TP_fast_assign(
> -		unsigned long freerun = (thresh + bg_thresh) / 2;
> +		unsigned long freerun = (dtc->thresh + dtc->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 +
>  						freerun) / 2;
> -		__entry->dirty		= dirty;
> +		__entry->dirty		= dtc->dirty;
>  		__entry->bdi_setpoint	= __entry->setpoint *
> -						bdi_thresh / (thresh + 1);
> -		__entry->bdi_dirty	= bdi_dirty;
> +						dtc->wb_thresh / (dtc->thresh + 1);
> +		__entry->bdi_dirty	= dtc->wb_dirty;
>  		__entry->dirty_ratelimit = KBps(dirty_ratelimit);
>  		__entry->task_ratelimit	= KBps(task_ratelimit);
>  		__entry->dirtied	= dirtied;

I don't know how much of a fast path these tracepoints are in, but instead
of doing the divisions above, why not just save the values in the ring
buffer, and do the divisions in the TP_printk() section, which is done when
the user reads it and not when the code is executing?

-- Steve


  reply	other threads:[~2025-03-04 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 11:03 [PATCH v2 0/3] Fix calculations in trace_balance_dirty_pages() for cgwb Tang Yizhou
2025-03-04 11:03 ` [PATCH v2 1/3] writeback: Let trace_balance_dirty_pages() take struct dtc as parameter Tang Yizhou
2025-03-04 15:39   ` Steven Rostedt [this message]
2025-03-04 11:03 ` [PATCH v2 2/3] writeback: Rename variables in trace_balance_dirty_pages() Tang Yizhou
2025-03-04 11:03 ` [PATCH v2 3/3] writeback: Fix calculations in trace_balance_dirty_pages() for cgwb Tang Yizhou

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=20250304103957.08c79da0@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhiramat@kernel.org \
    --cc=tj@kernel.org \
    --cc=willy@infradead.org \
    --cc=yizhou.tang@shopee.com \
    /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