On Wed, 28 Jun 2017 09:29:58 -0700 Shaohua Li <shli@xxxxxxxxxx> wrote: > From: Shaohua Li <shli@xxxxxx> > > Currently blktrace isn't cgroup aware. blktrace prints out task name of > current context, but the task of current context isn't always in the > cgroup where the BIO comes from. We can't use task name to find out IO > cgroup. For example, Writeback BIOs always comes from flusher thread but > the BIOs are for different blk cgroups. Request could be requeued and > dispatched from completely different tasks. MD/DM are another examples. > > This patch tries to fix the gap. We print out cgroup fhandle info in > blktrace. Userspace can use open_by_handle_at() syscall to find the > cgroup by fhandle. Or userspace can use name_to_handle_at() syscall to > find fhandle for a cgroup and use a BPF program to filter out blktrace > for a specific cgroup. > > We add a new 'blk_cgroup' trace option for blk tracer. It's default off. > Application which doesn't know the new option isn't affected. When it's > on, we output fhandle info right after blk_io_trace with an extra bit > set in event action. So from application point of view, blktrace with > the option will output new actions. > > I didn't change blk trace event yet, since I'm not sure if changing the > trace event output is an ABI issue. If not, I'll do it later. > > Signed-off-by: Shaohua Li <shli@xxxxxx> > --- > include/uapi/linux/blktrace_api.h | 3 + > kernel/trace/blktrace.c | 231 ++++++++++++++++++++++++++------------ > 2 files changed, 161 insertions(+), 73 deletions(-) Doing a quick scan of the patch, nothing sticks out as an issue to me. Acked-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> -- Steve