mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
proc/kcore: don't grab lock for kclist_add()
Patch series "/proc/kcore improvements", v4. This series makes a few improvements to /proc/kcore. It fixes a couple of small issues in v3 but is otherwise the same. Patches 1, 2, and 3 are prep patches. Patch 4 is a fix/cleanup. Patch 5 is another prep patch. Patches 6 and 7 are optimizations to ->read(). Patch 8 makes it possible to enable CRASH_CORE on any architecture, which is needed for patch 9. Patch 9 adds vmcoreinfo to /proc/kcore. This patch (of 9): 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. While we're here, mark kclist_add() with __init so that we'll get a warning if it's called from non-init code. Link: http://lkml.kernel.org/r/98208db1faf167aa8b08eebfa968d95c70527739.1531953780.git.osandov@fb.com Signed-off-by: Omar Sandoval <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Reviewed-by: Bhupesh Sharma <[email protected]> Tested-by: Bhupesh Sharma <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Bhupesh Sharma <[email protected]> Cc: Eric Biederman <[email protected]> Cc: James Morse <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
df865e8337
commit
a8dd9c4df1
2 files changed
+4
-5
No files matched your search
+3
-4
@@ -62,16 +62,15 @@ static LIST_HEAD(kclist_head);
|
||||
static DEFINE_RWLOCK(kclist_lock);
|
||||
static int kcore_need_update = 1;
|
||||
|
||||
void
|
||||
kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
|
||||
/* This doesn't grab kclist_lock, so it should only be used at init time. */
|
||||
void __init kclist_add(struct kcore_list *new, void *addr, size_t size,
|
||||
int type)
|
||||
{
|
||||
new->addr = (unsigned long)addr;
|
||||
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)
|
||||
|
||||
@@ -35,7 +35,7 @@ struct vmcoredd_node {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROC_KCORE
|
||||
extern void kclist_add(struct kcore_list *, void *, size_t, int type);
|
||||
void __init kclist_add(struct kcore_list *, void *, size_t, int type);
|
||||
#else
|
||||
static inline
|
||||
void kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
|
||||
|
||||
Reference in new issue
Block a user