Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp194321imm; Thu, 12 Jul 2018 17:11:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpculPyjNHvkKCI59Sdk0fCQCO7o9Z/4kfrfsMwg/bagzx8qnmqWf3Mbvg38uDpTMT3j0D6Y X-Received: by 2002:a62:3c4f:: with SMTP id j76-v6mr4585707pfa.119.1531440714502; Thu, 12 Jul 2018 17:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531440714; cv=none; d=google.com; s=arc-20160816; b=q0AsLhYVBTcdBUVe4Yzg0UGYnpUUB1nM32121OEp8IDjCzcGl6EDXpuemXJDhXraYG QFTqBdPGabkzCkdh1JhgThEDSNtV3fNxg7nmwJEBji/GvkN76c+GsUDcT8CqZqKMCyTn zNsbAqV+hEy5SflDXzgxMraCxwh4YuNGAq3G017FDGV5UC0LYMKBWTKZucu4fz8g+Aqi olMJCx54rbW3IaqsZWTeQs2CLjBHMO1K87uQzaZdKiE/i+No1LjBJYwWuiKzT5fQM5ad E5T/ZZvDPzf5TAUUm2ojy6ehZSjMK6wSrOuCwHRe2f49quV+yL7k0m1vkW293CKXibuk fYgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=mOok6eRTTKMGqaqxnoShfJFyRtKog3VsHFbGQRiYpqw=; b=lNUn66PBOSyTO3vSjkwxQYY/t9wpYF3pEQbtjpo8e4evqW26ijvPiqUO493x2YKdaI CN3ZSOYxshioQSa4FkKc/iW69HnYE024gAqrskQ2doHZwjZ17RB2NyNN4jlTUmOgSqYp 9x1DY2UEld6gCyvhACVUj99hCvQIYmhb20tA7b81RHrwqz26gl6/xVQXMw3/k0ybBuBy iGEjKAM2V2rMnAyxRYz/Q9de/kTRtD+xh+x8ajUubwh2kBkHOe2yWVr4OhuSP39pxF/H /op/LzEWDji9lwJhSuVYuMXltX6tU1Rf5OQKRVK+hf+fJf5/CRs6YsWFygaLWiUhokmY GSTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=LmEonp3c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si23043545plg.491.2018.07.12.17.11.39; Thu, 12 Jul 2018 17:11:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=LmEonp3c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387896AbeGMAWY (ORCPT + 99 others); Thu, 12 Jul 2018 20:22:24 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34561 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387763AbeGMAVo (ORCPT ); Thu, 12 Jul 2018 20:21:44 -0400 Received: by mail-pg1-f193.google.com with SMTP id y5-v6so4382150pgv.1 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=b9pRJZjc2nxqCFdjeZnCS4MBFku5JzklO9WUBRiibPdR57/9HJ4wDEUgMy66Z6e7Su 6vsKsYFTetx365QiRMhGlUWDg4/hk/TUm37T2u5/4FicAx5rTnK1FW8cbYjN5sD7PUTV 7IEzQ+QrTMtWl8SGrgoKm1emPjt0VQP9QZ/x4/bRsagh0/2yh7Rrz1AF8MRTirmmsde1 JLgAqpZAlcpjxcOz9BLhx0hC7JApR33Ulkm1RtUnulg/6EdgKfFVH5PJsDZA6u5spcJt lS0+C6NASlO6t3Z4oEl1BYfqRF3YFMMym2/CBn3sXHBk62hqnJYcoBkBJ/PQZRI3na+y mqbg== X-Gm-Message-State: AOUpUlFEwGd5k5eQxAW9QjRzVemfADRptMY882vZviKLAi+xqwuOg+Fy 3I6Nk3q0L81A68xlCe9Baw0Ub3bbBuk= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.18.0