From patchwork Fri Jul 6 19:32:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10512487 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 2A94A6024A for ; Fri, 6 Jul 2018 19:37:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A85E28752 for ; Fri, 6 Jul 2018 19:37:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E4D5287A2; Fri, 6 Jul 2018 19:37:18 +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 AD14128752 for ; Fri, 6 Jul 2018 19:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934680AbeGFThP (ORCPT ); Fri, 6 Jul 2018 15:37:15 -0400 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) 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=uFlzTZ0zFM/O1ySzVbJUUjy3l6Fednek6oq+KppzKd0=; b=tgBkn+zlhOrPbUe0CtZnHPqgnbz2naE+0YiHNlqSIvW48ZsMyUciYERN9wwlFy4Zwv bm8bc2/FZF+1OJBStOzj6A74kqijWPDfqLQspQnsHRVzPRRcuyl8QYygF5GqjAsykjjs 3+zk8KZs32D6Vd/9H+AcYhTn/vTHVnXoUPtyH80ayfi96HhHbLnlGJGdJF0UK6M1vyZE sofqjsRdM4K0u88pBp3KFBR4d5j2BfM674VsjkdqHq/NCWJVjjxG0hD5TVXDfYWjrGjL oc2/mzNI/IliGcHGyP29joOcFDx5afy0UDSpSPkBvFyB5I2uybIOeyMag1+Raxy2SjI0 ZQZA== 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=uFlzTZ0zFM/O1ySzVbJUUjy3l6Fednek6oq+KppzKd0=; b=PgDVgQRi5oCKt6OVJd/koMLHjdFrBwCoq3iNGoSfpl41S+OqC/v8MVw99OujqbQptQ QpnwM4nT2kaKOAb4MPbiA81on8L5OFmggKtDjaUF6TQgmjvRJV/0SmNuE6XNloJpVxff 5DbAhxiZl/6lYVX3a0+0qnQBRnX1Eqol5uhDotAtakUiwhgw0DY0pBITd2nwyk21lUE8 xVHnfyDXu6r2wPFwewEa/VII+bpxaLQwLnFFHWvtCTdnd719kAsWOA4y/jHwoOwftnsG caHAk1L9sIR/uO8wkcu9F3nL7KhePZXESbm56msypYKZrYXexGhlS4zV1GGNpEWQaMU4 Bgfw== X-Gm-Message-State: APt69E0WAdYPSIQAAbi17tWT6Ts6G0Mxhssk1CQJuBEDO6kl7DyX4M5W BsXbD3YSvOYjlJv8ezeAtGh5nk7Nvtk= X-Google-Smtp-Source: AAOMgpfdcu0f/rSulQtKh1hBAPy8Y2qbiXPB95yCQD9ir1ZFwUwJhattho/umjC0ksfJ0o9nb0I+pQ== X-Received: by 2002:a65:6210:: with SMTP id d16-v6mr10250232pgv.272.1530905566337; Fri, 06 Jul 2018 12:32:46 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::4:984e]) by smtp.gmail.com with ESMTPSA id a11-v6sm12846162pgq.32.2018.07.06.12.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jul 2018 12:32:45 -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: 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 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)