From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C08AC2BA19 for ; Mon, 6 Apr 2020 09:46:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 436B3206F5 for ; Mon, 6 Apr 2020 09:46:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 436B3206F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CC77A8E000E; Mon, 6 Apr 2020 05:46:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7A1B8E000D; Mon, 6 Apr 2020 05:46:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B683C8E000E; Mon, 6 Apr 2020 05:46:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9F9718E000D for ; Mon, 6 Apr 2020 05:46:36 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 61732181AEF23 for ; Mon, 6 Apr 2020 09:46:36 +0000 (UTC) X-FDA: 76676950392.09.worm68_39a00f9d5e23e X-HE-Tag: worm68_39a00f9d5e23e X-Filterd-Recvd-Size: 6846 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Apr 2020 09:46:35 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0369XbMA131898 for ; Mon, 6 Apr 2020 05:46:35 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 306kuv8d4p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Apr 2020 05:46:35 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Apr 2020 10:46:12 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 6 Apr 2020 10:46:08 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0369kSTs60817466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Apr 2020 09:46:28 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4869BA405F; Mon, 6 Apr 2020 09:46:28 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A009EA405C; Mon, 6 Apr 2020 09:46:27 +0000 (GMT) Received: from pomme.local (unknown [9.145.52.152]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 6 Apr 2020 09:46:27 +0000 (GMT) Subject: Re: [PATCH 7/8] mmap locking API: add MMAP_LOCK_INITIALIZER To: Michel Lespinasse , Andrew Morton , linux-mm Cc: LKML , Peter Zijlstra , Vlastimil Babka , Matthew Wilcox , Liam Howlett , Jerome Glisse , Davidlohr Bueso , David Rientjes , Hugh Dickins , Ying Han References: <20200326070236.235835-1-walken@google.com> <20200326070236.235835-8-walken@google.com> From: Laurent Dufour Date: Mon, 6 Apr 2020 11:46:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200326070236.235835-8-walken@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr X-TM-AS-GCONF: 00 x-cbid: 20040609-4275-0000-0000-000003BA9033 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040609-4276-0000-0000-000038CFED5A Message-Id: <1c463464-1d72-287e-e785-f077a95ccf20@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-06_05:2020-04-03,2020-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 clxscore=1011 spamscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004060078 Content-Transfer-Encoding: quoted-printable 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: Le 26/03/2020 =C3=A0 08:02, Michel Lespinasse a =C3=A9crit=C2=A0: > 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. I can't see the benefit of this change. The overall idea is to hide the mmap_sem name. Here the macro=20 MMAP_LOCK_INITIALIZER() doesn't hide the name. I think we can keep that in place until the real change of the mmap_sem t= o=20 something else. Cheers, Laurent. >=20 > 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(-) >=20 > 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 =3D { > .pgd =3D swapper_pg_dir, > .mm_users =3D ATOMIC_INIT(2), > .mm_count =3D ATOMIC_INIT(1), > - .mmap_sem =3D __RWSEM_INITIALIZER(init_mm.mmap_sem), > + .mmap_sem =3D MMAP_LOCK_INITIALIZER(init_mm.mmap_sem), > .page_table_lock =3D __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), > .mmlist =3D 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 =3D { > .mm_rb =3D RB_ROOT, > .mm_users =3D ATOMIC_INIT(2), > .mm_count =3D ATOMIC_INIT(1), > - .mmap_sem =3D __RWSEM_INITIALIZER(efi_mm.mmap_sem), > + .mmap_sem =3D MMAP_LOCK_INITIALIZER(efi_mm.mmap_sem), > .page_table_lock =3D __SPIN_LOCK_UNLOCKED(efi_mm.page_table_lock), > .mmlist =3D LIST_HEAD_INIT(efi_mm.mmlist), > .cpu_bitmap =3D { [BITS_TO_LONGS(NR_CPUS)] =3D 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 > =20 > +#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 =3D { > .pgd =3D swapper_pg_dir, > .mm_users =3D ATOMIC_INIT(2), > .mm_count =3D ATOMIC_INIT(1), > - .mmap_sem =3D __RWSEM_INITIALIZER(init_mm.mmap_sem), > + .mmap_sem =3D MMAP_LOCK_INITIALIZER(init_mm.mmap_sem), > .page_table_lock =3D __SPIN_LOCK_UNLOCKED(init_mm.page_table_lock), > .arg_lock =3D __SPIN_LOCK_UNLOCKED(init_mm.arg_lock), > .mmlist =3D LIST_HEAD_INIT(init_mm.mmlist), >=20