Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp144848ybz; Tue, 21 Apr 2020 17:16:43 -0700 (PDT) X-Google-Smtp-Source: APiQypJ0jeBMWqJGN5jxHFV4osvcUyjGhqUy1zEsggK2ZqrpWmH9KPPxN18RJZm0AMqp6pGRfn8e X-Received: by 2002:a05:6402:1b91:: with SMTP id cc17mr12177482edb.46.1587514602782; Tue, 21 Apr 2020 17:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587514602; cv=none; d=google.com; s=arc-20160816; b=geic4mmf3NqtMo9DeNcWu9kKwfIBZoAEo2rnLUtKcJD31lgvevZTMqG+c68xTPByB7 geVTyVGZnPlsuj2kK6Zdt/OE7gdbKzXO+utE/dSimS0U+bTjP80rsc7l8Cje/kHMnVGo EGnx2tOzbedkBshZ551VNtjaFIVfbuiLH+p9q6aqLH4d6AJVv1KRfg9EID6qbNh5s0NA nqGCFMMzHTVk/WF+rLtXouXijv3H2oiDoVZ1TY+zG4HFOFtD1TN7rDpT3KztBgf7AzPj 523eAiqvgJ4mXjiP1vSzdZEqd9BwET0chRelBcaZvVc1FhfhavqI9mbxXrAqBoQ/ZFn/ JBGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=2opZsbHIn/7vppLXalOzj/KzjaH4KmbCOQZ36m9L9lE=; b=luFD0XK3ChSAEji1r5XmrRUj+tprOdDuNlimBcWRPRbJPAw/hhFvQAeB2q3/jeD6Ur 2PLNdg4nA3JdpiiFWlOSrOFABKgt8WXlGq4KarsBFE2n1XKY72hPDpez24XnM/9Z3Owb eByBdenY7shn4pV4wci92C9kR38p3hivtN/QBBciHnfI5ursz1Pb+d+ennwtXHlHQuGN fSZ9px9I6q4G4yaUjsEmMwksRE1b3tzBUZIN1DUTW/HzcSfDxl+J2BcK/Fz3ZQKCDVKV 7pt1yrTDRpFKlXo3MNvTMDZ7xO5tBcKjDj3NMtQaKWpLE6e8tCwumQttyz0pkgA0Yl3F txPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YU+Dpsuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l27si2751231edj.537.2020.04.21.17.16.20; Tue, 21 Apr 2020 17:16:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YU+Dpsuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbgDVAOs (ORCPT + 99 others); Tue, 21 Apr 2020 20:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbgDVAOp (ORCPT ); Tue, 21 Apr 2020 20:14:45 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72B62C03C1A6 for ; Tue, 21 Apr 2020 17:14:44 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id t18so237126pgi.1 for ; Tue, 21 Apr 2020 17:14:44 -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=2opZsbHIn/7vppLXalOzj/KzjaH4KmbCOQZ36m9L9lE=; b=YU+DpsujXi0dVqJJUn+VODEzULokQfOL0DEI1YbafX+yE0cHnEjcF9d9u7UqxpJGa7 3BcZBWBvk9crC3TVt+cufx3Fss2NCMhw6FWgs071GWBCKXJeIFvaWfxJEzUxbNvaYkJa j+6TfuSj3AiBez+mBQSM2YW7w9QCdSp+sFTVVQ8ugkK2yjdrw3Toaiel9ipwHGk+lGFu Kc4IY/Ztnjd1luBlFc1lraZ2m3sNb6BzDrJGoeXVNV/Xh8gbvbaViErJH43THqBdEFOf p2hSFugDNMm6rwwkVT+KxJC/7Q/n5/sZwMRsJ0SqpOPicpMfREqWL++llmwCv0eqVjCJ ZukQ== 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=2opZsbHIn/7vppLXalOzj/KzjaH4KmbCOQZ36m9L9lE=; b=TUx+04JxFtCb08kPokEAXRFOgWZv36RBsgtGYjeh8T+AoFthwiNtGlW05+HrFII/Cb CbM9+xGAX6eadNvmgN6visEFN1DjZAFnVftcr09HBHt0P0SR7OjA5PVSDIV6kV86dYSC 9PX1eXzJC2C2E3oGt5nWdQ1u1foXVbFTqQm5/8hh7DCQn9b0bpiMkL/d3ZOyOt0s2Sji YHK3qJW/JUQWc2UXpPCx64U08ZbLgTBULLIwKlKu+mDjF6UKKwWoApfr4xj8ZrJeK6Ag CqANbjLNLPtHXLHTOekj638GWA0sdYcfmjQaengg0R0cwScvs8DJcFMR5KNsMX/oX71U WsPg== X-Gm-Message-State: AGi0PuYGe3XgymPd21SbOCxL2w6XAbVg8E0RUZLTFG0cEa0TviaPr9RW pb6T6nlYys8YI4dE2PEcag2JLItiqqI= X-Received: by 2002:a17:90a:2709:: with SMTP id o9mr8504791pje.168.1587514483951; Tue, 21 Apr 2020 17:14:43 -0700 (PDT) Date: Tue, 21 Apr 2020 17:14:20 -0700 In-Reply-To: <20200422001422.232330-1-walken@google.com> Message-Id: <20200422001422.232330-9-walken@google.com> Mime-Version: 1.0 References: <20200422001422.232330-1-walken@google.com> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog Subject: [PATCH v5 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 3 +++ mm/init-mm.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c index b89f6ac6a0c0..885058325c20 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_LOCK_INITIALIZER(init_mm) .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..916313ec8acb 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_LOCK_INITIALIZER(efi_mm) .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 d1826ce42f00..9e104835a0d1 100644 --- a/include/linux/mmap_lock.h +++ b/include/linux/mmap_lock.h @@ -1,6 +1,9 @@ #ifndef _LINUX_MMAP_LOCK_H #define _LINUX_MMAP_LOCK_H +#define MMAP_LOCK_INITIALIZER(name) \ + .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), + 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..fe9c03d8e07b 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_LOCK_INITIALIZER(init_mm) .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), -- 2.26.1.301.g55bc3eb7cb9-goog