From: Andrew Morton on
On Wed, 4 Aug 2010 17:43:24 -0700
Michael Rubin <mrubin(a)google.com> wrote:

> To help developers and applications gain visibility into writeback
> behaviour adding four read only sysctl files into /proc/sys/vm.
> These files allow user apps to understand writeback behaviour over time
> and learn how it is impacting their performance.
>
> # cat /proc/sys/vm/pages_dirtied
> 3747
> # cat /proc/sys/vm/pages_entered_writeback
> 3618
>
> Documentation/vm.txt has been updated.
>
> In order to track the "cleaned" and "dirtied" counts we added two
> vm_stat_items. Per memory node stats have been added also. So we can
> see per node granularity:
>
> # cat /sys/devices/system/node/node20/writebackstat
> Node 20 pages_writeback: 0 times
> Node 20 pages_dirtied: 0 times
>
> ...
>
> @@ -1091,6 +1115,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping)
> {
> if (mapping_cap_account_dirty(mapping)) {
> __inc_zone_page_state(page, NR_FILE_DIRTY);
> + __inc_zone_page_state(page, NR_FILE_PAGES_DIRTIED);
> __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
> task_dirty_inc(current);
> task_io_account_write(PAGE_CACHE_SIZE);

I hope the utility of this change is worth the overhead :(

> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -740,6 +740,8 @@ static const char * const vmstat_text[] = {
> "numa_local",
> "numa_other",
> #endif
> + "nr_pages_entered_writeback",
> + "nr_file_pages_dirtied",
>

Wait. These counters appear in /proc/vmstat. So why create standalone
/proc/sys/vm files as well?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: KOSAKI Motohiro on
> On Thu, Aug 5, 2010 at 1:24 PM, Andrew Morton <akpm(a)linux-foundation.org> wrote:
> > On Wed, �4 Aug 2010 17:43:24 -0700
> > Michael Rubin <mrubin(a)google.com> wrote:
> > Wait. �These counters appear in /proc/vmstat. �So why create standalone
> > /proc/sys/vm files as well?
>
> I did not know they would show up in /proc/vmstat.
>
> I thought it made sense to put them in /proc/sys/vm since the other
> writeback controls are there.
> but have no problems just adding them to /prov/vmstat if that makes more sense.

?

/proc/vmstat already have both.

cat /proc/vmstat |grep nr_dirty
cat /proc/vmstat |grep nr_writeback

Also, /sys/devices/system/node/node0/meminfo show per-node stat.

Perhaps, I'm missing your point.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: KOSAKI Motohiro on
> On Thu, Aug 5, 2010 at 4:56 PM, KOSAKI Motohiro
> <kosaki.motohiro(a)jp.fujitsu.com> wrote:
> > /proc/vmstat already have both.
> >
> > cat /proc/vmstat |grep nr_dirty
> > cat /proc/vmstat |grep nr_writeback
> >
> > Also, /sys/devices/system/node/node0/meminfo show per-node stat.
> >
> > Perhaps, I'm missing your point.
>
> These only show the number of dirty pages present in the system at the
> point they are queried.
> The counter I am trying to add are increasing over time. They allow
> developers to see rates of pages being dirtied and entering writeback.
> Which is very helpful.

Usually administrators get the data two times and subtract them. Isn't it sufficient?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: KOSAKI Motohiro on
> On Fri, 6 Aug 2010 09:18:59 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro(a)jp.fujitsu.com> wrote:
>
> > > On Thu, Aug 5, 2010 at 4:56 PM, KOSAKI Motohiro
> > > <kosaki.motohiro(a)jp.fujitsu.com> wrote:
> > > > /proc/vmstat already have both.
> > > >
> > > > cat /proc/vmstat |grep nr_dirty
> > > > cat /proc/vmstat |grep nr_writeback
> > > >
> > > > Also, /sys/devices/system/node/node0/meminfo show per-node stat.
> > > >
> > > > Perhaps, I'm missing your point.
> > >
> > > These only show the number of dirty pages present in the system at the
> > > point they are queried.
> > > The counter I am trying to add are increasing over time. They allow
> > > developers to see rates of pages being dirtied and entering writeback.
> > > Which is very helpful.
> >
> > Usually administrators get the data two times and subtract them. Isn't it sufficient?
> >
>
> Nope. The existing nr_dirty is "number of pages dirtied since boot"
> minus "number of pages cleaned since boot". If you do the
> wait-one-second-then-subtract thing on nr_dirty, the result is
> dirtying-bandwidth minus cleaning-bandwidth, and can't be used to
> determine dirtying-bandwidth.

Technically, yes. I meant, _now_, typical administrators are using the
subtraction.
Do you mean this is wrong? or do you mean you have another use case?

Just curious.


> I can see that a graph of dirtying events versus time could be an
> interesting thing. I don't see how it could be obtained using the
> existing instrumentation. tracepoints, probably..

I think it depend on frequency of the usecase. If the usecase is enouth
major, convenience way (e.g. /proc/vmstat) is very helpful.

probably, I haven't understand the usecase of this feature.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/