All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajay Kaher <akaher@vmware.com>
To: rostedt@goodmis.org, shuah@kernel.org, mhiramat@kernel.org
Cc: chinglinyu@google.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, lkp@intel.com,
	namit@vmware.com, oe-lkp@lists.linux.dev, akaher@vmware.com,
	amakhalov@vmware.com, er.ajay.kaher@gmail.com,
	srivatsa@csail.mit.edu, tkundu@vmware.com,
	vsirnapalli@vmware.com
Subject: [PATCH v6 00/10] tracing: introducing eventfs
Date: Fri, 28 Jul 2023 23:50:42 +0530	[thread overview]
Message-ID: <1690568452-46553-1-git-send-email-akaher@vmware.com> (raw)

Events Tracing infrastructure contains lot of files, directories
(internally in terms of inodes, dentries). And ends up by consuming
memory in MBs. We can have multiple events of Events Tracing, which
further requires more memory.

Instead of creating inodes/dentries, eventfs could keep meta-data and
skip the creation of inodes/dentries. As and when require, eventfs will
create the inodes/dentries only for required files/directories.
Also eventfs would delete the inodes/dentries once no more requires
but preserve the meta data.

Tracing events took ~9MB, with this approach it took ~4.5MB
for ~10K files/dir.

Diff from v5:
Patch 02: removed TRACEFS_EVENT_INODE enum.
Patch 04: added TRACEFS_EVENT_INODE enum.
Patch 06: removed WARN_ON_ONCE in eventfs_set_ef_status_free()
Patch 07: added WARN_ON_ONCE in create_dentry()
          moved declaration of following to internal.h:
          eventfs_start_creating()
          eventfs_failed_creating()
          eventfs_end_creating()
Patch 08: added WARN_ON_ONCE in eventfs_set_ef_status_free()

Diff from v4:
Patch 02: moved from v4 08/10
          added fs/tracefs/internal.h
Patch 03: moved from v4 02/10
          removed fs/tracefs/internal.h
Patch 04: moved from v4 03/10
          moved out changes of fs/tracefs/internal.h
Patch 05: moved from v4 04/10
          renamed eventfs_add_top_file() -> eventfs_add_events_file()
Patch 06: moved from v4 07/10
          implemented create_dentry() helper function
          added create_file(), create_dir() stub function
Patch 07: moved from v4 06/10
Patch 08: moved from v4 05/10
          improved eventfs remove functionality
Patch 09: removed unwanted if conditions
Patch 10: added available_filter_functions check

Diff from v3:
Patch 3,4,5,7,9:
         removed all the eventfs_rwsem code and replaced it with an srcu
         lock for the readers, and a mutex to synchronize the writers of
         the list.
Patch 2: moved 'tracefs_inode' and 'get_tracefs()' to v4 03/10
Patch 3: moved the struct eventfs_file and eventfs_inode into event_inode.c
         as it really should not be exposed to all users.
Patch 5: added a recursion check to eventfs_remove_rec() as it is really
         dangerous to have unchecked recursion in the kernel (we do have
         a fixed size stack).
         have the free use srcu callbacks. After the srcu grace periods
         are done, it adds the eventfs_file onto a llist (lockless link
         list) and wakes up a work queue. Then the work queue does the
         freeing (this needs to be done in task/workqueue context, as
         srcu callbacks are done in softirq context).
Patch 6: renamed:
         eventfs_create_file() -> create_file()
         eventfs_create_dir() -> create_dir()

Diff from v2:
Patch 01: new patch:'Require all trace events to have a TRACE_SYSTEM'
Patch 02: moved from v1 1/9
Patch 03: moved from v1 2/9
          As suggested by Zheng Yejian, introduced eventfs_prepare_ef()
          helper function to add files or directories to eventfs
          fix WARNING reported by kernel test robot in v1 8/9
Patch 04: moved from v1 3/9
          used eventfs_prepare_ef() to add files
          fix WARNING reported by kernel test robot in v1 8/9
Patch 05: moved from v1 4/9
          fix compiling warning reported by kernel test robot in v1 4/9
Patch 06: moved from v1 5/9
Patch 07: moved from v1 6/9
Patch 08: moved from v1 7/9
Patch 09: moved from v1 8/9
          rebased because of v3 01/10
Patch 10: moved from v1 9/9

Diff from v1:
Patch 1: add header file
Patch 2: resolved kernel test robot issues
         protecting eventfs lists using nested eventfs_rwsem
Patch 3: protecting eventfs lists using nested eventfs_rwsem
Patch 4: improve events cleanup code to fix crashes
Patch 5: resolved kernel test robot issues
         removed d_instantiate_anon() calls
Patch 6: resolved kernel test robot issues
         fix kprobe test in eventfs_root_lookup()
         protecting eventfs lists using nested eventfs_rwsem
Patch 7: remove header file
Patch 8: pass eventfs_rwsem as argument to eventfs functions
         called eventfs_remove_events_dir() instead of tracefs_remove()
         from event_trace_del_tracer()
Patch 9: new patch to fix kprobe test case

 fs/tracefs/Makefile                           |   1 +
 fs/tracefs/event_inode.c                      | 801 ++++++++++++++++++
 fs/tracefs/inode.c                            | 151 +++-
 fs/tracefs/internal.h                         |  29 +
 include/linux/trace_events.h                  |   1 +
 include/linux/tracefs.h                       |  23 +
 kernel/trace/trace.h                          |   2 +-
 kernel/trace/trace_events.c                   |  76 +-
 .../ftrace/test.d/kprobe/kprobe_args_char.tc  |   9 +-
 .../test.d/kprobe/kprobe_args_string.tc       |   9 +-
 10 files changed, 1050 insertions(+), 52 deletions(-)
 create mode 100644 fs/tracefs/event_inode.c
 create mode 100644 fs/tracefs/internal.h

-- 
2.39.0


             reply	other threads:[~2023-07-28 18:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28 18:20 Ajay Kaher [this message]
2023-07-28 18:20 ` [PATCH v6 01/10] tracing: Require all trace events to have a TRACE_SYSTEM Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 02/10] eventfs: Implement tracefs_inode_cache Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 03/10] tracefs: Rename and export some tracefs functions Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 04/10] eventfs: Implement eventfs dir creation functions Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 05/10] eventfs: Implement eventfs file add functions Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 06/10] eventfs: Implement eventfs lookup, read, open functions Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 07/10] eventfs: Implement functions to create files and dirs when accessed Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 08/10] eventfs: Implement removal of meta data from eventfs Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 09/10] eventfs: Move tracing/events to eventfs Ajay Kaher
2023-07-28 18:20 ` [PATCH v6 10/10] test: ftrace: Fix kprobe test for eventfs Ajay Kaher

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=1690568452-46553-1-git-send-email-akaher@vmware.com \
    --to=akaher@vmware.com \
    --cc=amakhalov@vmware.com \
    --cc=chinglinyu@google.com \
    --cc=er.ajay.kaher@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=namit@vmware.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=srivatsa@csail.mit.edu \
    --cc=tkundu@vmware.com \
    --cc=vsirnapalli@vmware.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.