From patchwork Fri Jul 13 00:09:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10522463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCC216032C for ; Fri, 13 Jul 2018 00:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC22029372 for ; Fri, 13 Jul 2018 00:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0857296BE; Fri, 13 Jul 2018 00:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ACD429372 for ; Fri, 13 Jul 2018 00:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387887AbeGMAWY (ORCPT ); Thu, 12 Jul 2018 20:22:24 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:42572 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387715AbeGMAVo (ORCPT ); Thu, 12 Jul 2018 20:21:44 -0400 Received: by mail-pg1-f194.google.com with SMTP id y4-v6so4328407pgp.9 for ; Thu, 12 Jul 2018 17:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mOok6eRTTKMGqaqxnoShfJFyRtKog3VsHFbGQRiYpqw=; b=LmEonp3cXMlUBjF7yIJy5KxFHSPctHQBN2BOkwHXf+w4q8O94MSR4UmAal58g9UjLt ZobsljlvsPPbYMuWBXigDidTfFScMS5Ridp063/Qs4WVYYN46EjZ7Ka2Fm7U0bHA6q4X hWCMUjT2badQOGlcx35IFt7H57J3R1QEO4YwYVdCmYmJ4lufqUd5DUSfy4eHNI7hajJg pOWbxGRMQZNUzvOSJXMOI5RzLAE6kHqZ4+5tDurFe1pbFjnjPyuU5Z2OcrZXifSA1b+n TyX7x/Z0gWVhZQpTdustB8dfOkQfo3QOofQ8fEileqZ/F0MxSiyh2mSx3FWSAmY6K7La aCtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mOok6eRTTKMGqaqxnoShfJFyRtKog3VsHFbGQRiYpqw=; b=BVAMlYq9odiz74YccLVRAra3kPZgt3QvssINSWPZIC54hAlnfnLb/T2tKG7nKStu4s h9EfYOwVrq3cb5PwbSnaUx//5Pa6nmMDgWBhy3e4kgsD3ZyeazAUZyTHlW7F/C/f2bwP +k4gFB3pMDC3DU70Ck2fOvOauQ7WxCaOHO5WTjtnPgaDmlTGzKWtiBuIkU2fbefZsOgA 2ap6LPH9xa5vd52PzbSV93uIcJnBJ42ahqJCgZRqUHZNzbsl1VwYwQrWqe0omZy9aVRy smy+yN7HEDWFWoCtpO8lsNNjVkN1FFlvYeFDISdw41VlU4RHABqpnbtXLsSByE1270qp TRTg== X-Gm-Message-State: AOUpUlE3TlQXB0hJuL7p6x/szb4s+KQt+Ez2yxMVuK6dXyMCfklsuwq1 LXZ6+8eBJLrnVtK3c8DieYoqDw== X-Google-Smtp-Source: AAOMgpdab1kWuRdenNCsng//Ik0Two8N1wdCawD3Wn0Sx2VxJ1Knqv4UvXnr8HuecLo+8P+tKNrA/A== X-Received: by 2002:aa7:88d3:: with SMTP id p19-v6mr4566482pfo.160.1531440587036; Thu, 12 Jul 2018 17:09:47 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::5:74a0]) by smtp.gmail.com with ESMTPSA id b86-v6sm4452067pfj.35.2018.07.12.17.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 17:09:46 -0700 (PDT) From: Omar Sandoval To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton Cc: Alexey Dobriyan , Eric Biederman , James Morse , Bhupesh Sharma , kernel-team@fb.com Subject: [PATCH v2 1/7] proc/kcore: don't grab lock for kclist_add() Date: Thu, 12 Jul 2018 17:09:33 -0700 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 66c373230e60..ddeeb3a5a015 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)