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=-7.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 2B7EEC4338F for ; Mon, 16 Aug 2021 00:26:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A589B61214 for ; Mon, 16 Aug 2021 00:26:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A589B61214 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EEDDF8D0001; Sun, 15 Aug 2021 20:26:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9E756B0072; Sun, 15 Aug 2021 20:26:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8CD58D0001; Sun, 15 Aug 2021 20:26:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id BCB476B0071 for ; Sun, 15 Aug 2021 20:26:12 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3CD361CFD5 for ; Mon, 16 Aug 2021 00:26:12 +0000 (UTC) X-FDA: 78479051784.07.B428374 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 4D89E70148F7 for ; Mon, 16 Aug 2021 00:26:11 +0000 (UTC) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GnvxX4cbbzdb63; Mon, 16 Aug 2021 08:22:24 +0800 (CST) Received: from dggpeml500016.china.huawei.com (7.185.36.70) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 08:26:07 +0800 Received: from [10.174.148.223] (10.174.148.223) by dggpeml500016.china.huawei.com (7.185.36.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 08:26:06 +0800 Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC To: David Laight , 'Khalid Aziz' , Matthew Wilcox CC: Steven Sistare , Anthony Yznaga , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "Gonglei (Arei)" References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> <6775a78fa70b4868bfd24c750ec24bdd@AcuMS.aculab.com> From: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" Message-ID: <0591d6d4-5844-13ac-9e22-722e22c911f4@huawei.com> Date: Mon, 16 Aug 2021 08:26:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <6775a78fa70b4868bfd24c750ec24bdd@AcuMS.aculab.com> Content-Type: text/plain; charset="utf-8" X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500016.china.huawei.com (7.185.36.70) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4D89E70148F7 X-Stat-Signature: o4urnw1bygid9sebrxz4dh1jb4sonp66 Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of longpeng2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=longpeng2@huawei.com X-HE-Tag: 1629073571-216861 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi David, =E5=9C=A8 2021/8/15 4:07, David Laight =E5=86=99=E9=81=93: > ... >>>>> Let me describe my use case more clearly (just ignore if you're not >>>>> interested in it): >>>>> >>>>> 1. Prog A mmap() 4GB memory (anon or file-mapping), suppose the >>>>> allocated VA range is [0x40000000,0x140000000) >>>>> >>>>> 2. Prog A specifies [0x48000000,0x50000000) and >>>>> [0x80000000,0x100000000) will be shared by its child. >>>>> >>>>> 3. Prog A fork() Prog B and then Prog B exec() a new ELF binary. >>>>> >>>>> 4. Prog B notice the shared ranges (e.g. by input parameters or >>>>> ...) >>>>> and remap them to a continuous VA range. >=20 > Remapping to contiguous VA is going to be difficult in the > general case for (IIRC) VIVT caches. > The required cache coherence may only be attainable by > using uncached mappings. >=20 The Prog B uses mremap() syscall to remapping the shared ranges to other = places, this is a common case for mremap in userspace. The cache coherence should already be processed in mremap core logic, oth= erwise there's maybe something wrong in mremap(). > David >=20 > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, M= K1 1PT, UK > Registration No: 1397386 (Wales) >=20 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=-7.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 1FFFAC4338F for ; Mon, 16 Aug 2021 00:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E970461261 for ; Mon, 16 Aug 2021 00:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231742AbhHPA0m (ORCPT ); Sun, 15 Aug 2021 20:26:42 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:13424 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbhHPA0l (ORCPT ); Sun, 15 Aug 2021 20:26:41 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GnvxX4cbbzdb63; Mon, 16 Aug 2021 08:22:24 +0800 (CST) Received: from dggpeml500016.china.huawei.com (7.185.36.70) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 08:26:07 +0800 Received: from [10.174.148.223] (10.174.148.223) by dggpeml500016.china.huawei.com (7.185.36.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 16 Aug 2021 08:26:06 +0800 Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC To: David Laight , 'Khalid Aziz' , Matthew Wilcox CC: Steven Sistare , Anthony Yznaga , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "Gonglei (Arei)" References: <1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com> <43471cbb-67c6-f189-ef12-0f8302e81b06@oracle.com> <55720e1b39cff0a0f882d8610e7906dc80ea0a01.camel@oracle.com> <6775a78fa70b4868bfd24c750ec24bdd@AcuMS.aculab.com> From: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" Message-ID: <0591d6d4-5844-13ac-9e22-722e22c911f4@huawei.com> Date: Mon, 16 Aug 2021 08:26:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <6775a78fa70b4868bfd24c750ec24bdd@AcuMS.aculab.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.148.223] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500016.china.huawei.com (7.185.36.70) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, 在 2021/8/15 4:07, David Laight 写道: > ... >>>>> Let me describe my use case more clearly (just ignore if you're not >>>>> interested in it): >>>>> >>>>> 1. Prog A mmap() 4GB memory (anon or file-mapping), suppose the >>>>> allocated VA range is [0x40000000,0x140000000) >>>>> >>>>> 2. Prog A specifies [0x48000000,0x50000000) and >>>>> [0x80000000,0x100000000) will be shared by its child. >>>>> >>>>> 3. Prog A fork() Prog B and then Prog B exec() a new ELF binary. >>>>> >>>>> 4. Prog B notice the shared ranges (e.g. by input parameters or >>>>> ...) >>>>> and remap them to a continuous VA range. > > Remapping to contiguous VA is going to be difficult in the > general case for (IIRC) VIVT caches. > The required cache coherence may only be attainable by > using uncached mappings. > The Prog B uses mremap() syscall to remapping the shared ranges to other places, this is a common case for mremap in userspace. The cache coherence should already be processed in mremap core logic, otherwise there's maybe something wrong in mremap(). > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) >