From patchwork Fri Mar 27 02:10:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 11461561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D923014B4 for ; Fri, 27 Mar 2020 02:11:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A678420787 for ; Fri, 27 Mar 2020 02:11:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="At+xhy3b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A678420787 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C59176B0072; Thu, 26 Mar 2020 22:11:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C08A06B0073; Thu, 26 Mar 2020 22:11:22 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF9C56B0074; Thu, 26 Mar 2020 22:11:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id 8FD0B6B0072 for ; Thu, 26 Mar 2020 22:11:22 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 87291180AD817 for ; Fri, 27 Mar 2020 02:11:22 +0000 (UTC) X-FDA: 76639515204.08.judge07_bf877d4eaf1d X-Spam-Summary: 2,0,0,4609d2384a6937cb,d41d8cd98f00b204,3ywb9xgykchouyjiclemmejc.amkjglsv-kkityai.mpe@flex--walken.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3152:3353:3740:3865:3867:3871:4250:4321:4605:5007:6119:6261:6653:6742:9969:10004:10400:11026:11473:11658:11914:12043:12114:12296:12297:12438:12555:12895:12986:14096:14097:14181:14394:14659:14721:21080:21444:21451:21627:30029:30054,0,RBL:209.85.214.201:@flex--walken.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: judge07_bf877d4eaf1d X-Filterd-Recvd-Size: 5661 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Mar 2020 02:11:22 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id d11so5918295pll.6 for ; Thu, 26 Mar 2020 19:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wKHWtKZXZ1jV5SPUsD2wXtJbpgHx5U7xHaRPqBEbazY=; b=At+xhy3bvcI8P6Yc9VFXhUNItfjaM47ENdzxAMxzs+lh79KmCnOH+DcQN5SdCRavdj r/9c68l7xeOc5p5Lv9UAbfIjXvPbIFWmg0/VBTrBpckAneIgr/afsQVBwF0mqAj2XyEu PnqcwBtPgI3PFCQbjvrGpB0R1uBE96hPorM8TGO+RvgpPvpRw9o5WxuACZ2LAMgrgBsX rwOsP7THEroAIoQ7tk2ObCt2/K6DOLDPogChYJveR2PdHQTulRBVxxJrdEDlk+h93o0x EswhFKcSNDdc1l5pJs8ZwuTY+jlPQghzLg1PcRInigqfwXRZFbZmZwJ3P57vmUfaoB0P XufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wKHWtKZXZ1jV5SPUsD2wXtJbpgHx5U7xHaRPqBEbazY=; b=W3J0MKhZrFiRMHCmM+YAd4dYOWrKeYb7g8TreDMHPoBQ8rjJoF/MJQ2A9xYWtMOzM9 +uTBtpqXUPD4TQp+klfvkngROTEDiIAbM8TXY8FO87Qm27OBb1HbXsczewAXhC9OEv4T Z+GrGrEQoK9OGEYQW/3G79snRKua8oOmlQrjZcS804xYGoSgubtE8eGgSn1gHdsz0oab 1S2Tv8D1V09cKDqbevqvZ0t9BL28NwkfIVa1j8qbGraoiSgdifeiCR6vD+EkK80MLOsa uQ16d/iTAF22l9Mghp+crCs9wOSO8HQTfajtR7HF/uBixw1X0f3tdrRCgNQcDSV4irR3 NF2g== X-Gm-Message-State: ANhLgQ3biF+0TNtWVzzCiWDlkxvHMwtvRg6DsPBcA1GBZdEv4jHMLh0L htQrZuGMJDFJ1m/jVLmbw5m8B06BYdU= X-Google-Smtp-Source: ADFU+vvExyAv/OwWEEYNlmMFQDR227S8p/tJ1ZA9i/UH27AjA6V7+1ax3JYRqqLD8k6EwwISQNiuTVn6krw= X-Received: by 2002:a17:90a:b391:: with SMTP id e17mr3408370pjr.55.1585275081027; Thu, 26 Mar 2020 19:11:21 -0700 (PDT) Date: Thu, 26 Mar 2020 19:10:56 -0700 In-Reply-To: <20200327021058.221911-1-walken@google.com> Message-Id: <20200327021058.221911-9-walken@google.com> Mime-Version: 1.0 References: <20200327021058.221911-1-walken@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [PATCH v2 08/10] mmap locking API: add MMAP_LOCK_INITIALIZER From: Michel Lespinasse To: Andrew Morton , linux-mm Cc: LKML , Peter Zijlstra , Laurent Dufour , Vlastimil Babka , Matthew Wilcox , Liam Howlett , Jerome Glisse , Davidlohr Bueso , David Rientjes , Hugh Dickins , Ying Han , Jason Gunthorpe , Markus Elfring , Michel Lespinasse X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Define a new initializer for the mmap locking api. Initially this just evaluates to __RWSEM_INITIALIZER as the API is defined as wrappers around rwsem. Signed-off-by: Michel Lespinasse --- arch/x86/kernel/tboot.c | 2 +- drivers/firmware/efi/efi.c | 2 +- include/linux/mmap_lock.h | 2 ++ mm/init-mm.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index b89f6ac6a0c0..4b79335624b1 100644 --- a/arch/x86/kernel/tboot.c +++ b/arch/x86/kernel/tboot.c @@ -90,7 +90,7 @@ static struct mm_struct tboot_mm = { .pgd = swapper_pg_dir, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), - .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem), + .mmap_sem = MMAP_LOCK_INITIALIZER(init_mm.mmap_sem), .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), .mmlist = LIST_HEAD_INIT(init_mm.mmlist), }; diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 21ea99f65113..5bdfe698cd7f 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -60,7 +60,7 @@ struct mm_struct efi_mm = { .mm_rb = RB_ROOT, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), - .mmap_sem = __RWSEM_INITIALIZER(efi_mm.mmap_sem), + .mmap_sem = MMAP_LOCK_INITIALIZER(efi_mm.mmap_sem), .page_table_lock = __SPIN_LOCK_UNLOCKED(efi_mm.page_table_lock), .mmlist = LIST_HEAD_INIT(efi_mm.mmlist), .cpu_bitmap = { [BITS_TO_LONGS(NR_CPUS)] = 0}, diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h index 00d6cc02581d..7474b15bba38 100644 --- a/include/linux/mmap_lock.h +++ b/include/linux/mmap_lock.h @@ -1,6 +1,8 @@ #ifndef _LINUX_MMAP_LOCK_H #define _LINUX_MMAP_LOCK_H +#define MMAP_LOCK_INITIALIZER(name) __RWSEM_INITIALIZER(name) + static inline void mmap_init_lock(struct mm_struct *mm) { init_rwsem(&mm->mmap_sem); diff --git a/mm/init-mm.c b/mm/init-mm.c index 19603302a77f..3c128bd6a30c 100644 --- a/mm/init-mm.c +++ b/mm/init-mm.c @@ -31,7 +31,7 @@ struct mm_struct init_mm = { .pgd = swapper_pg_dir, .mm_users = ATOMIC_INIT(2), .mm_count = ATOMIC_INIT(1), - .mmap_sem = __RWSEM_INITIALIZER(init_mm.mmap_sem), + .mmap_sem = MMAP_LOCK_INITIALIZER(init_mm.mmap_sem), .page_table_lock = __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), .arg_lock = __SPIN_LOCK_UNLOCKED(init_mm.arg_lock), .mmlist = LIST_HEAD_INIT(init_mm.mmlist),