linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [block/for-next] writeback: don't access page->mapping directly in track_foreign_dirty TP
Date: Mon, 2 Sep 2019 10:56:28 +0200	[thread overview]
Message-ID: <20190902085628.GC14207@quack2.suse.cz> (raw)
In-Reply-To: <20190830233954.GC2263813@devbig004.ftw2.facebook.com>

On Fri 30-08-19 16:39:54, Tejun Heo wrote:
> page->mapping may encode different values in it and page_mapping()
> should always be used to access the mapping pointer.
> track_foreign_dirty tracepoint was incorrectly accessing page->mapping
> directly.  Use page_mapping() instead.  Also, add NULL checks while at
> it.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Reported-by: Jan Kara <jack@suse.cz>
> Fixes: 3a8e9ac89e6a ("writeback: add tracepoints for cgroup foreign writebacks")

I can see Jens already picked this up so this is just informative: The patch
now looks good to me.

								Honza

> ---
>  include/trace/events/writeback.h |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
> index 3dc9fb9e7c78..3a27335fce2c 100644
> --- a/include/trace/events/writeback.h
> +++ b/include/trace/events/writeback.h
> @@ -251,9 +251,12 @@ TRACE_EVENT(track_foreign_dirty,
>  	),
>  
>  	TP_fast_assign(
> +		struct address_space *mapping = page_mapping(page);
> +		struct inode *inode = mapping ? mapping->host : NULL;
> +
>  		strncpy(__entry->name,	dev_name(wb->bdi->dev), 32);
>  		__entry->bdi_id		= wb->bdi->id;
> -		__entry->ino		= page->mapping->host->i_ino;
> +		__entry->ino		= inode ? inode->i_ino : 0;
>  		__entry->memcg_id	= wb->memcg_css->id;
>  		__entry->cgroup_ino	= __trace_wb_assign_cgroup(wb);
>  		__entry->page_cgroup_ino = page->mem_cgroup->css.cgroup->kn->id.ino;
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      parent reply	other threads:[~2019-09-02  9:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 23:39 [block/for-next] writeback: don't access page->mapping directly in track_foreign_dirty TP Tejun Heo
2019-08-31  1:54 ` Jens Axboe
2019-09-02  8:56 ` Jan Kara [this message]

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=20190902085628.GC14207@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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).