All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] fs: don't use module helpers in non-modular code
@ 2015-12-17 19:10 ` Paul Gortmaker
  0 siblings, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2015-12-17 19:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Al Viro, Andrew Morton, David Howells,
	Davidlohr Bueso, David Rientjes, Eric Paris, Hillf Danton,
	J. Bruce Fields, Jeff Layton, Josh Triplett, Mike Kravetz,
	Nadia Yvette Chambers, Naoya Horiguchi, Peter Hurley,
	linux-fsdevel, linux-mm

This series of commits is a slice of a larger project to ensure
people don't needlessly use modular support functions in non-modular
code.  Overall there was roughly 5k lines of unused _exit code and
".remove" functions in the kernel due to this.  So far we've fixed
several areas, like tty, x86, net, etc. and we continue here in fs/

There are several reasons to not use module helpers for code that can
never be built as a module, but the big ones are:

 (1) it is easy to accidentally code up an unused module_exit function
 (2) it can be misleading when reading the source, thinking it can be
      modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
     includes nearly everything else, thus increasing CPP overhead.

Fortunately the code here is core fs code and not strictly a driver
in the sense that a UART or GPIO driver is.  So we don't have a lot
of unused code to remove, and mainly gain in avoiding #2 and #3 above.

Here we convert some module_init() calls into fs_initcall().  In doing
so we must note that this changes the init ordering slightly, since
module_init() becomes device_initcall() in the non-modular case, and
that comes after fs_initcall().

We could have used device_initcall here to strictly preserve the old
ordering, and that largely makes sense for drivers/* dirs.  But using
device_initcall in the fs/ dir just seems wrong when we have the staged
initcall system and a fs_initcall bucket in that tiered system.

The hugetlb patch warrants special mention.  It has code in both the
fs dir and the mm dir, with initcalls in each.  There is an implicit
requirement that the mm one be executed prior to the fs one, else
the runtime will splat.  Currently we achieve that only by luck of the
link order.  With the changes made here, we use our existing initcall
buckets properly to guarantee that ordering.

Since I have a large queue, I'm hoping to get as many of these as
possible in via maintainers, so that I'm not left someday asking
Linus to pull a giant series.

[v1 --> v2: drop 2 patches merged elsewhere, combine mm & fs chunks
 of hugetlb patch into one & update log accordingly.]

---

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: David Rientjes <rientjes@google.com>
Cc: Eric Paris <eparis@parisplace.org>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@poochiereds.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Nadia Yvette Chambers <nyc@holomorphy.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org

The following changes since commit 9f9499ae8e6415cefc4fe0a96ad0e27864353c89:

  Linux 4.4-rc5 (2015-12-13 17:42:58 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git fs_initcall

for you to fetch changes up to 7763d3b42ca62dc967cc56218df8007401e63cd0:

  fs: make binfmt_elf.c explicitly non-modular (2015-12-17 12:11:19 -0500)

----------------------------------------------------------------

Paul Gortmaker (8):
  hugetlb: make mm and fs code explicitly non-modular
  fs: make notify dnotify.c explicitly non-modular
  fs: make fcntl.c explicitly non-modular
  fs: make filesystems.c explicitly non-modular
  fs: make locks.c explicitly non-modular
  fs: make direct-io.c explicitly non-modular
  fs: make devpts/inode.c explicitly non-modular
  fs: make binfmt_elf.c explicitly non-modular

 fs/binfmt_elf.c             | 11 +----------
 fs/devpts/inode.c           |  3 +--
 fs/direct-io.c              |  4 ++--
 fs/fcntl.c                  |  4 +---
 fs/filesystems.c            |  2 +-
 fs/hugetlbfs/inode.c        | 27 ++-------------------------
 fs/locks.c                  |  3 +--
 fs/notify/dnotify/dnotify.c |  4 +---
 mm/hugetlb.c                | 39 +--------------------------------------
 9 files changed, 11 insertions(+), 86 deletions(-)

-- 
2.6.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-12-20  2:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17 19:10 [PATCH v2 0/8] fs: don't use module helpers in non-modular code Paul Gortmaker
2015-12-17 19:10 ` Paul Gortmaker
2015-12-17 19:10 ` Paul Gortmaker
2015-12-17 19:10 ` [PATCH 1/8] hugetlb: make mm and fs code explicitly non-modular Paul Gortmaker
2015-12-17 19:10   ` Paul Gortmaker
2015-12-17 19:10   ` Paul Gortmaker
2015-12-17 22:45   ` Mike Kravetz
2015-12-17 22:45     ` Mike Kravetz
2015-12-18  2:46   ` Davidlohr Bueso
2015-12-18  2:46     ` Davidlohr Bueso
2015-12-17 19:11 ` [PATCH 2/8] fs: make notify dnotify.c " Paul Gortmaker
2015-12-17 19:11 ` [PATCH 3/8] fs: make fcntl.c " Paul Gortmaker
2015-12-17 19:11 ` [PATCH 4/8] fs: make filesystems.c " Paul Gortmaker
2015-12-17 19:11 ` [PATCH 5/8] fs: make locks.c " Paul Gortmaker
2015-12-18 12:07   ` Jeff Layton
2015-12-17 19:11 ` [PATCH 6/8] fs: make direct-io.c " Paul Gortmaker
2015-12-17 19:11 ` [PATCH 7/8] fs: make devpts/inode.c " Paul Gortmaker
2015-12-17 19:46   ` Peter Hurley
2015-12-20  2:52     ` Paul Gortmaker
2015-12-17 19:11 ` [PATCH 8/8] fs: make binfmt_elf.c " Paul Gortmaker

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.