With cgroup v2 writeback, we can know these pages are written from which
cgroup.
So expose the cgroup_ino for better tracking.
Signed-off-by: Yafang Shao <[email protected]>
---
fs/fs-writeback.c | 4 ++--
include/trace/events/writeback.h | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 36855c1..e98a33e 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1973,7 +1973,7 @@ void wb_workfn(struct work_struct *work)
*/
do {
pages_written = wb_do_writeback(wb);
- trace_writeback_pages_written(pages_written);
+ trace_writeback_pages_written(wb, pages_written);
} while (!list_empty(&wb->work_list));
} else {
/*
@@ -1983,7 +1983,7 @@ void wb_workfn(struct work_struct *work)
*/
pages_written = writeback_inodes_wb(wb, 1024,
WB_REASON_FORKER_THREAD);
- trace_writeback_pages_written(pages_written);
+ trace_writeback_pages_written(wb, pages_written);
}
if (!list_empty(&wb->work_list))
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 32db72c..a806713 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -255,15 +255,18 @@ static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *w
DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
TRACE_EVENT(writeback_pages_written,
- TP_PROTO(long pages_written),
- TP_ARGS(pages_written),
+ TP_PROTO(struct bdi_writeback *wb, long pages_written),
+ TP_ARGS(wb, pages_written),
TP_STRUCT__entry(
__field(long, pages)
+ __field(unsigned int, cgroup_ino)
),
TP_fast_assign(
__entry->pages = pages_written;
+ __entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
),
- TP_printk("%ld", __entry->pages)
+ TP_printk("pages=%ld cgroup_ino=%u",
+ __entry->pages, __entry->cgroup_ino)
);
DECLARE_EVENT_CLASS(writeback_class,
--
1.8.3.1
On Sat 23-02-19 21:35:49, Yafang Shao wrote:
> With cgroup v2 writeback, we can know these pages are written from which
> cgroup.
> So expose the cgroup_ino for better tracking.
>
> Signed-off-by: Yafang Shao <[email protected]>
Fine by me. You can add:
Acked-by: Jan Kara <[email protected]>
Honza
> ---
> fs/fs-writeback.c | 4 ++--
> include/trace/events/writeback.h | 9 ++++++---
> 2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 36855c1..e98a33e 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1973,7 +1973,7 @@ void wb_workfn(struct work_struct *work)
> */
> do {
> pages_written = wb_do_writeback(wb);
> - trace_writeback_pages_written(pages_written);
> + trace_writeback_pages_written(wb, pages_written);
> } while (!list_empty(&wb->work_list));
> } else {
> /*
> @@ -1983,7 +1983,7 @@ void wb_workfn(struct work_struct *work)
> */
> pages_written = writeback_inodes_wb(wb, 1024,
> WB_REASON_FORKER_THREAD);
> - trace_writeback_pages_written(pages_written);
> + trace_writeback_pages_written(wb, pages_written);
> }
>
> if (!list_empty(&wb->work_list))
> diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
> index 32db72c..a806713 100644
> --- a/include/trace/events/writeback.h
> +++ b/include/trace/events/writeback.h
> @@ -255,15 +255,18 @@ static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *w
> DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
>
> TRACE_EVENT(writeback_pages_written,
> - TP_PROTO(long pages_written),
> - TP_ARGS(pages_written),
> + TP_PROTO(struct bdi_writeback *wb, long pages_written),
> + TP_ARGS(wb, pages_written),
> TP_STRUCT__entry(
> __field(long, pages)
> + __field(unsigned int, cgroup_ino)
> ),
> TP_fast_assign(
> __entry->pages = pages_written;
> + __entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
> ),
> - TP_printk("%ld", __entry->pages)
> + TP_printk("pages=%ld cgroup_ino=%u",
> + __entry->pages, __entry->cgroup_ino)
> );
>
> DECLARE_EVENT_CLASS(writeback_class,
> --
> 1.8.3.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR
On Tue, Mar 19, 2019 at 6:40 PM Jan Kara <[email protected]> wrote:
>
> On Sat 23-02-19 21:35:49, Yafang Shao wrote:
> > With cgroup v2 writeback, we can know these pages are written from which
> > cgroup.
> > So expose the cgroup_ino for better tracking.
> >
> > Signed-off-by: Yafang Shao <[email protected]>
>
> Fine by me. You can add:
>
> Acked-by: Jan Kara <[email protected]>
>
Thanks for your review :-)
>
> > ---
> > fs/fs-writeback.c | 4 ++--
> > include/trace/events/writeback.h | 9 ++++++---
> > 2 files changed, 8 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> > index 36855c1..e98a33e 100644
> > --- a/fs/fs-writeback.c
> > +++ b/fs/fs-writeback.c
> > @@ -1973,7 +1973,7 @@ void wb_workfn(struct work_struct *work)
> > */
> > do {
> > pages_written = wb_do_writeback(wb);
> > - trace_writeback_pages_written(pages_written);
> > + trace_writeback_pages_written(wb, pages_written);
> > } while (!list_empty(&wb->work_list));
> > } else {
> > /*
> > @@ -1983,7 +1983,7 @@ void wb_workfn(struct work_struct *work)
> > */
> > pages_written = writeback_inodes_wb(wb, 1024,
> > WB_REASON_FORKER_THREAD);
> > - trace_writeback_pages_written(pages_written);
> > + trace_writeback_pages_written(wb, pages_written);
> > }
> >
> > if (!list_empty(&wb->work_list))
> > diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
> > index 32db72c..a806713 100644
> > --- a/include/trace/events/writeback.h
> > +++ b/include/trace/events/writeback.h
> > @@ -255,15 +255,18 @@ static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *w
> > DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
> >
> > TRACE_EVENT(writeback_pages_written,
> > - TP_PROTO(long pages_written),
> > - TP_ARGS(pages_written),
> > + TP_PROTO(struct bdi_writeback *wb, long pages_written),
> > + TP_ARGS(wb, pages_written),
> > TP_STRUCT__entry(
> > __field(long, pages)
> > + __field(unsigned int, cgroup_ino)
> > ),
> > TP_fast_assign(
> > __entry->pages = pages_written;
> > + __entry->cgroup_ino = __trace_wb_assign_cgroup(wb);
> > ),
> > - TP_printk("%ld", __entry->pages)
> > + TP_printk("pages=%ld cgroup_ino=%u",
> > + __entry->pages, __entry->cgroup_ino)
> > );
> >
> > DECLARE_EVENT_CLASS(writeback_class,
> > --
> > 1.8.3.1
> >
> --
> Jan Kara <[email protected]>
> SUSE Labs, CR