From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:36366 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934717AbeGFTcq (ORCPT ); Fri, 6 Jul 2018 15:32:46 -0400 Received: by mail-pf0-f193.google.com with SMTP id u16-v6so9179612pfh.3 for ; Fri, 06 Jul 2018 12:32:46 -0700 (PDT) From: Omar Sandoval To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan Cc: Eric Biederman , kernel-team@fb.com Subject: [PATCH 1/7] proc/kcore: don't grab lock for kclist_add() Date: Fri, 6 Jul 2018 12:32:32 -0700 Message-Id: In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Omar Sandoval 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. Signed-off-by: Omar Sandoval --- fs/proc/kcore.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index e64ecb9f2720..afd1ff8c2d3f 100644 --- a/fs/proc/kcore.c +++ b/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 *addr, size_t size, int type) 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) -- 2.18.0