linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Curt Wohlgemuth <curtw@google.com>
Cc: Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>,
	Michael Rubin <mrubin@google.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 1/2 v2] writeback: Add a 'reason' to wb_writeback_work
Date: Mon, 15 Aug 2011 21:19:15 +0800	[thread overview]
Message-ID: <20110815131915.GA13534@localhost> (raw)
In-Reply-To: <1313189245-7197-1-git-send-email-curtw@google.com>

Hi Curt,

This is a very useful patch, thanks!  Nitpicks followed :)

> +       enum wb_stats reason;           /* why was writeback initiated? */

Not about this patch, but some time later, some one may well find the
->for_background, ->for_kupdate fields duplicated with ->reason, and
try to eliminate the struct fields as well as the trace point fields :)

>  /*
> + * why this writeback was initiated
> + */
> +enum wb_stats {
> +       /* The following are counts of pages written for a specific cause */
> +       WB_STAT_BALANCE_DIRTY,
> +       WB_STAT_BG_WRITEOUT,
> +       WB_STAT_TRY_TO_FREE_PAGES,
> +       WB_STAT_SYNC,
> +       WB_STAT_KUPDATE,
> +       WB_STAT_LAPTOP_TIMER,
> +       WB_STAT_FREE_MORE_MEM,
> +       WB_STAT_FS_FREE_SPACE,
> +       WB_STAT_FORKER_THREAD,
> +
> +       WB_STAT_MAX,
> +};

I find it more comfortable to use "reason", "enum wb_reason" and
WB_REASON_* uniformly. Yeah, I read in the next patch that you'll add
other stat fields, however they are different in concept and looks
better be put to another enum. With some index shift, it should yield
the same efficient code, with better code readability.

> +#define show_work_reason(reason)                                       \
> +       __print_symbolic(reason,                                        \
> +               {WB_STAT_BALANCE_DIRTY,         "balance_dirty"},       \
> +               {WB_STAT_BG_WRITEOUT,           "background"},          \
> +               {WB_STAT_TRY_TO_FREE_PAGES,     "try_to_free_pages"},   \
> +               {WB_STAT_SYNC,                  "sync"},                \
> +               {WB_STAT_KUPDATE,               "periodic"},            \
> +               {WB_STAT_LAPTOP_TIMER,          "laptop_timer"},        \
> +               {WB_STAT_FREE_MORE_MEM,         "free_more_memory"},    \
> +               {WB_STAT_FS_FREE_SPACE,         "FS_free_space"}        \
> +       )

Some symbolic names disagree with the names used in the next patch..

> -                 "kupdate=%d range_cyclic=%d background=%d",
> +                 "kupdate=%d range_cyclic=%d background=%d reason=%s",

Here is the obvious duplicates. I'm not sure if there are serious
scripts relying on the kupdate/background fields (none from me), and
if we are going to carry this redundancy in future..

>  TRACE_EVENT(writeback_queue_io,
>         TP_PROTO(struct bdi_writeback *wb,
> -                unsigned long *older_than_this,
> +                struct wb_writeback_work *work,
>                  int moved),
> -       TP_ARGS(wb, older_than_this, moved),
> +       TP_ARGS(wb, work, moved),
>         TP_STRUCT__entry(
>                 __array(char,           name, 32)
>                 __field(unsigned long,  older)
>                 __field(long,           age)
>                 __field(int,            moved)
> +               __field(int,            reason)
>         ),
>         TP_fast_assign(
>                 strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
> -               __entry->older  = older_than_this ?  *older_than_this : 0;
> -               __entry->age    = older_than_this ?
> -                                 (jiffies - *older_than_this) * 1000 / HZ : -1;
> +               __entry->older  = work->older_than_this ?
> +                                               *work->older_than_this : 0;
> +               __entry->age    = work->older_than_this ?
> +                         (jiffies - *work->older_than_this) * 1000 / HZ : -1;

The older_than_this change seems big enough for a standalone patch.

Thanks,
Fengguang

  parent reply	other threads:[~2011-08-15 13:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 22:47 [PATCH 1/2 v2] writeback: Add a 'reason' to wb_writeback_work Curt Wohlgemuth
2011-08-12 22:47 ` [PATCH 2/2 v2] writeback: Add writeback stats for pages written Curt Wohlgemuth
2011-08-15 13:48   ` Wu Fengguang
2011-08-15 17:16     ` Curt Wohlgemuth
2011-08-15 18:40       ` Jan Kara
2011-08-15 18:56         ` Curt Wohlgemuth
2011-08-16 13:10           ` Jan Kara
2011-08-16 12:10       ` Wu Fengguang
2011-08-15 15:03   ` Jan Kara
2011-08-15 17:24     ` Curt Wohlgemuth
2011-08-16 12:26       ` Wu Fengguang
2011-08-15 13:19 ` Wu Fengguang [this message]
2011-09-28 15:02 ` [PATCH 1/2 v2] writeback: Add a 'reason' to wb_writeback_work Christoph Hellwig
2011-10-07 15:28   ` Wu Fengguang
2011-10-07 18:07     ` Curt Wohlgemuth

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=20110815131915.GA13534@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=curtw@google.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mrubin@google.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;
as well as URLs for NNTP newsgroup(s).