From patchwork Fri Mar 27 22:51:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 11463259 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 0679E14B4 for ; Fri, 27 Mar 2020 22:51:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C7F69208E0 for ; Fri, 27 Mar 2020 22:51:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="N5lgoeki" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7F69208E0 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 A67076B0072; Fri, 27 Mar 2020 18:51:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A16E56B0073; Fri, 27 Mar 2020 18:51:26 -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 828746B0074; Fri, 27 Mar 2020 18:51:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id 5B6E26B0072 for ; Fri, 27 Mar 2020 18:51:26 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 326C05DEB for ; Fri, 27 Mar 2020 22:51:26 +0000 (UTC) X-FDA: 76642640172.03.frame88_46b42a681620b X-Spam-Summary: 2,0,0,bc3c46d81f2530ad,d41d8cd98f00b204,3bin-xgykcgcbfqpjslttlqj.htrqnszc-rrpafhp.twl@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.216.73:@flex--walken.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.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:23,LUA_SUMMARY:none X-HE-Tag: frame88_46b42a681620b X-Filterd-Recvd-Size: 5654 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Mar 2020 22:51:25 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id l12so8211579pjq.3 for ; Fri, 27 Mar 2020 15:51:25 -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=28kVchorg0pFyF9b0ogWAEAHMYZwNEgdx4vJfdA+cNY=; b=N5lgoekiDT0KdtpBQyJZN+rAhSDRFgLYlqk+FnMqCC7Nt+l8s5TsP6h3h1hSBisdOk lJXgZbgQ9BxYEI6MS6WTnWVZ9B0JV63iz6Ed/0Y4nIeyqDcGI1wwz0kKSy2k1h4K3alO laj97wLWd1WxTa2eydnBg1VD5ue6kv5hLxcrc7NYCnGZ09WQ7s16OnxC1MY0DldE1u1+ pgrRmyCqhY+13dYDwm/DpIfDoa/pXIOd1+dDJ/1ewCa3aZtVE/ePajwt2EfnOY/FFIKQ f6nAqkZwT4SeDkYc0/jpG0YZj/cDnDfzUUJJahq1IQ8RX9mGGnFV9boW7gJPggTJB2y4 bHrA== 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=28kVchorg0pFyF9b0ogWAEAHMYZwNEgdx4vJfdA+cNY=; b=mL/OlwDAg1uxXeKeQA+Ku6xF6RvGQxloMXsukM7aCvnRL91Der+N+ylA4YH2y0LSiv nhnT8wMq3zcdMDmLXfQhHx9e2WEYPp1jG6cgPTBbQSpoy0C1ViuOkJweUYZ0I9PrBZ74 SYcqi8cGEHO/kK32bq0Z4VmeiJYkJ7eU2IIQr/RlW6wMzYtIm0nanCSjSPmQu2rCFFHr 00lJ5e1RVg8GzFNaHqX+D4eHASIoOg0JEgQwCvryCcwME+3HYHRWysfxtCkpNYTz7tdk 9Ijnqx9z8KCRhJZZj4N00FIEwG/MSao/RaQmpx1QU3Mnj8w8SArB0GqbUpTJVsO0iglx Yc4g== X-Gm-Message-State: ANhLgQ0i1PKRJl0tYVMRnBjwDxUZ9frjGfgrqvWS+WnJm4url8xkpSFR SoHP9Iu5MEYv5ftm0hibaNUYSqmSXn0= X-Google-Smtp-Source: ADFU+vsZFnC2lgwaR/+bm7vWv24PAezbCSqsEnKPHHSSDCnNK07HbdoMMzr9genfbIzwWEfrvd1MyxKT7QY= X-Received: by 2002:a17:90a:5a42:: with SMTP id m2mr1746324pji.165.1585349484828; Fri, 27 Mar 2020 15:51:24 -0700 (PDT) Date: Fri, 27 Mar 2020 15:51:00 -0700 In-Reply-To: <20200327225102.25061-1-walken@google.com> Message-Id: <20200327225102.25061-9-walken@google.com> Mime-Version: 1.0 References: <20200327225102.25061-1-walken@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [PATCH v3 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 a80cf9695514..25a8a5458b84 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),