The patch titled Subject: proc/kcore: don't grab lock for kclist_add() has been added to the -mm tree. Its filename is proc-kcore-dont-grab-lock-for-kclist_add.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/proc-kcore-dont-grab-lock-for-kclist_add.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/proc-kcore-dont-grab-lock-for-kclist_add.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Omar Sandoval <osandov@xxxxxx> Subject: proc/kcore: don't grab lock for kclist_add() Patch series "/proc/kcore improvements", v2. This series makes a few improvements to /proc/kcore. Patches 1 and 2 are prep patches. Patch 3 is a fix/cleanup. Patch 4 is another prep patch. Patches 5 and 6 are optimizations to ->read(). Patch 7 adds vmcoreinfo to /proc/kcore (apparently I'm not the only one who wants this, see https://www.spinics.net/lists/arm-kernel/msg665103.html). I tested that the crash utility still works with this applied, and readelf is happy with it, as well. This patch (of 7): kclist_add() is only called at init time, so there's no point in grabbing any locks. We're also going to replace the rwlock with a rwsem, which we don't want to try grabbing during early boot. Link: http://lkml.kernel.org/r/ddbe991f42b8d49e50645878ad8c1a8168db2e82.1531440458.git.osandov@xxxxxx Signed-off-by: Omar Sandoval <osandov@xxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Bhupesh Sharma <bhsharma@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN fs/proc/kcore.c~proc-kcore-dont-grab-lock-for-kclist_add fs/proc/kcore.c --- a/fs/proc/kcore.c~proc-kcore-dont-grab-lock-for-kclist_add +++ a/fs/proc/kcore.c @@ -62,6 +62,7 @@ static LIST_HEAD(kclist_head); static DEFINE_RWLOCK(kclist_lock); static int kcore_need_update = 1; +/* This doesn't grab kclist_lock, so it should only be used at init time. */ void kclist_add(struct kcore_list *new, void *addr, size_t size, int type) { @@ -69,9 +70,7 @@ kclist_add(struct kcore_list *new, void new->size = size; new->type = type; - write_lock(&kclist_lock); list_add_tail(&new->list, &kclist_head); - write_unlock(&kclist_lock); } static size_t get_kcore_size(int *nphdr, size_t *elf_buflen) _ Patches currently in -mm which might be from osandov@xxxxxx are proc-kcore-dont-grab-lock-for-kclist_add.patch proc-kcore-replace-kclist_lock-rwlock-with-rwsem.patch proc-kcore-fix-memory-hotplug-vs-multiple-opens-race.patch proc-kcore-hold-lock-during-read.patch proc-kcore-clean-up-elf-header-generation.patch proc-kcore-optimize-multiple-page-reads.patch proc-kcore-add-vmcoreinfo-note-to-proc-kcore.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html