Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1321465pxy; Sun, 15 Aug 2021 17:34:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHZmYsP7H4ShASGU1K9KOrY8e8ttt/auUlniPTvE19vVKVT07a0VjkMaECl3VU7n/sDFYf X-Received: by 2002:a05:6602:14a:: with SMTP id v10mr10667534iot.36.1629074091927; Sun, 15 Aug 2021 17:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629074091; cv=none; d=google.com; s=arc-20160816; b=zz2OHX633v/0GTT17BTPedJYvEK/HslJiWcF+vbKYaky8Gn/ef3S6gUetzf5eH708s iqta+k6U9MuOVFHmviF8sWI3bI1Gq/F5Kuvr07bpUxBAnU4AXAf570++w8HBeButAJ2i rdloHEAxYeZZ0p9P4IyaFeRV2C2A+3Qc5UuIQk92qa+FUN0uWmBgbdOIzNxECcIIuC+/ tZ1Rzk2AgTfkqLb7edlEH065hUS5S9QYXpRG3lpmxsGW/h/nQA0xl11kxglO4ZyL7pqi q6Y8aTiFzSPonPq0/CA+4XvKfU4BIJES9zyPkpSkGtb7TTKjEQXukkFEdLflrKwk6M65 66Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=RlKP1MdEY3EyQSlYIvEMB5pIdjebOGnR3M6e2J4dal0=; b=FuqhKH4mZTV8Fq1Df5AIxNkfdXOlZCmaa2cV904fCsrxQLwrgHg5/QiP+aMCFz2TWZ PghQ91sEwDxesoFHYFLnHx38e0nfPodN4UA/whPL8SiFM8WtN/nfymsdIi9fg7NNOQla EFLMHGb7f9uRpy7i/FMwkK4eXLVPuYQ1Od8cmnfgwyAyaibuPgJeMNIeqFphLgXCx9Pr nAjvBni6XIKodUjayU3OKosk9ulOGlo/ETo30w+CMkNyHdbRcTofmGfuQGpPEHrR4Wob 24bbqvOxjT6o7u+Ew/PJZOwwO8RdcflJgPCWg8AsIo4SyLZ/TVFpWUeyjtErtARH78WW 8ccQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si10096504jaj.19.2021.08.15.17.34.28; Sun, 15 Aug 2021 17:34:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbhHPA0l (ORCPT + 99 others); Sun, 15 Aug 2021 20:26:41 -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) >