From patchwork Wed Apr 15 00:43:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 11489451 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 A929714B4 for ; Wed, 15 Apr 2020 00:44:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 75E5E2064A for ; Wed, 15 Apr 2020 00:44:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ds/J6oOw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75E5E2064A 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 8E7498E000E; Tue, 14 Apr 2020 20:44:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 898C18E000B; Tue, 14 Apr 2020 20:44:17 -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 7E0C28E000E; Tue, 14 Apr 2020 20:44:17 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id 634BE8E000B for ; Tue, 14 Apr 2020 20:44:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 26FE14DA8 for ; Wed, 15 Apr 2020 00:44:17 +0000 (UTC) X-FDA: 76708242954.22.year47_427a84ffb7f20 X-Spam-Summary: 2,0,0,fb7c76201e4c1aff,d41d8cd98f00b204,331iwxgykcoqcgrqktmuumrk.iusrotad-ssqbgiq.uxm@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.221.202:@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: year47_427a84ffb7f20 X-Filterd-Recvd-Size: 5651 Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Apr 2020 00:44:16 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id g7so977177vkk.15 for ; Tue, 14 Apr 2020 17:44:16 -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=zcekvyQ/72KhxhLDP4al7ATAbVuK8V+d9wz4X2X0YtE=; b=Ds/J6oOwyzOTUwwXAlvlhp+O91+I2jQ/wIee1X/rtO6hzkFM6Hux/qJ4ucZc/fa61q 3hifVqNY2O9qiCAP79Swxo5Jgqc5M1aKhjT92O0dZZH8yLwsLpMNfqD97YbAH2mk9YD8 DHLcz1zNk4SEax4MiqbLaE79+dfUkgYWJveiRpSv6AsTLtkLXtUccqHU8yxR8cGHlSQq fN71c4vnkwDPYio69zt8lckEir+kx2e/KPz++/eg+sxMMxqVb89hzwv8k5IBNZFWUzds oUMyiOcIb988ZEkc96Fc/laWjRtpNFN/re90lEvjZXJ9Plmkz9EfcvqW3t0FVN7za+4k cvvA== 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=zcekvyQ/72KhxhLDP4al7ATAbVuK8V+d9wz4X2X0YtE=; b=sNJ+SmJylLtvvwsibVz/ufl6TFNQ3MGHu1cw0vwmaiTCTVebuwAx8LiJ8JQmFUzqEf hQSSDaPY+A35aF/XjfkjNaKVDkB0ycx7z7M70WEhlG1DUmud4fkb6G1Rbkrhx3T0YRXz CYtY9GIfXSlzAKvEsmSeRPEnLdXUp2LpraEN7bA9jUIh6+hTI7UZO8WGDMeAvJfDr1SI xc6nkN4PV1oIsiHRMfARBGofT/OFwNiSbSeXU3fQ+tZ1qjaPArq0tM4ImWJTC1oTQUS0 Ztc/k8m/UT+u7SpTFSfHDuVpIQfGKnQvAi1HapNDOcu3xuNtdckQ3Jj/EjU1w4jUAOXp XzQQ== X-Gm-Message-State: AGi0PuZTRkoYlA107ZPCurjEIkouD+fVKok8T22CSGVbN4bBJTuz4w6G E0ElOb+84ZcrjOoVXpNkeDFKJSC3pP0= X-Google-Smtp-Source: APiQypJZ2eXP7ulP/b4UP2i1f+YdW/QLsG7S+zDoTgeqUfr3cwhuJZnYws3QuzMg8m+Pq5z8IX1BuuzgmAI= X-Received: by 2002:ab0:6449:: with SMTP id j9mr2559890uap.19.1586911455892; Tue, 14 Apr 2020 17:44:15 -0700 (PDT) Date: Tue, 14 Apr 2020 17:43:51 -0700 In-Reply-To: <20200415004353.130248-1-walken@google.com> Message-Id: <20200415004353.130248-9-walken@google.com> Mime-Version: 1.0 References: <20200415004353.130248-1-walken@google.com> X-Mailer: git-send-email 2.26.0.110.g2183baf09c-goog Subject: [PATCH v4 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 , Daniel Jordan , 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 911a2bd0f6b7..4bac9d7a48a6 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -54,7 +54,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 1050257361aa..07efa379664a 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),