Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755764AbbLQTOS (ORCPT ); Thu, 17 Dec 2015 14:14:18 -0500 Received: from mail.windriver.com ([147.11.1.11]:61301 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755714AbbLQTOO (ORCPT ); Thu, 17 Dec 2015 14:14:14 -0500 From: Paul Gortmaker To: 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 , , Subject: [PATCH v2 0/8] fs: don't use module helpers in non-modular code Date: Thu, 17 Dec 2015 14:10:58 -0500 Message-ID: <1450379466-23115-1-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.6.1 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4438 Lines: 105 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 Cc: Andrew Morton Cc: David Howells Cc: Davidlohr Bueso Cc: David Rientjes Cc: Eric Paris Cc: Hillf Danton Cc: "J. Bruce Fields" Cc: Jeff Layton Cc: Josh Triplett Cc: Mike Kravetz Cc: Nadia Yvette Chambers Cc: Naoya Horiguchi Cc: Peter Hurley 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/