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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS 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 1FB6BC43381 for ; Thu, 14 Feb 2019 16:55:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC36821928 for ; Thu, 14 Feb 2019 16:55:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC36821928 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 468958E0002; Thu, 14 Feb 2019 11:55:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 418E78E0001; Thu, 14 Feb 2019 11:55:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DFF88E0002; Thu, 14 Feb 2019 11:55:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id E2E9A8E0001 for ; Thu, 14 Feb 2019 11:55:34 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id n24so4677997pgm.17 for ; Thu, 14 Feb 2019 08:55:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :references:from:openpgp:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1Q2TuyCD73oIpYHfgAoLyLcqU7x3xNhtkD9ZCRglQm0=; b=LmsEnGpj/XgT6+Aj/PR2CPGpYedfjlgwW0wTusVbc8VnkjjP3yFcj/kjXekWClipa3 A6qGUtU+7uKcq8oSNC2+yevNAJojpgtpu5pRDaOZ7QGWgpd5RLDFZ4rynsw3XZdIjAji /M66WxeznGwMDNmcosWOVhf2uGd7/JVeptnYGLZPLEXKwHCVRp/b/9AONf+7EKsa8SZY WNbhZ8wlfGo5YuhnaRMFAyTKRfLzhzQgjsTksz78bjRzkgvXoteu9Vb7qK7BAo0aVHN4 EME4F33zlO/dZwIqa47d0JXfHm7b9omWGQod9yplyTxUn+zGZHwzuSlwNNWz4H9WjiVR 0BmQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.hansen@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AHQUAuZfo5oVhp48ljSj7PVTEfKD4RpxDC064v+YaTei9FMEzeW2f+VU 5mpE8pccQg+N/KPKm3LOFL2dm4hS1PZcOtyysyGEQYZDomEReeoefkrTR5dMA1FcTWOFL/wLdLu 3UWquhmcq/mgwhJCO8p4S5gJexPjG053/60AwuLHJUj4RkG4WUalMTaTGial8iRU/QA== X-Received: by 2002:a65:51ca:: with SMTP id i10mr4535688pgq.371.1550163334532; Thu, 14 Feb 2019 08:55:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IYgTfC0xExWQDpS/C9o8IN2KYKPxnV43XKGn8YsjllSG4cNBza+MZFOCOm8z07hF+iVaqew X-Received: by 2002:a65:51ca:: with SMTP id i10mr4535620pgq.371.1550163333392; Thu, 14 Feb 2019 08:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550163333; cv=none; d=google.com; s=arc-20160816; b=v5/iqULvIeGHZuV86lhdhukARH9rip/w6IbAKdIZMxF72VFbjofe68YHAwPvlsZz14 WBfLIhlgEneNRQb9ihOSLF4OHU50qZXAnq2X1vQCM8UFbBCNeEeyvrpDTNj4e80/Q5RM o1IA9nFqedtR9KOaZplFQsPetY0z4b/FN2v0EnJrmI8yqObjoKmwssf56Y2e3BR1fItq aqtwDynfHS5oCjZ9bf2M+XBMby1uphel1wMGX0YgJKAvKNyT8kMnfugZUwX4+J9m7Ekj YO/Hjv5RJaax4nwxciZ5yE1FdQ2yCpT5o+Y1WpKT1zp0FGxmUJRFzeEvXC4JYfbT9s/B cesA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:autocrypt:openpgp:from:references:cc:to :subject; bh=1Q2TuyCD73oIpYHfgAoLyLcqU7x3xNhtkD9ZCRglQm0=; b=j9bC9PYBJikt/6GLZRqyyNGnKJG9wy/dV1jVYeRkZBMnB7WQ9oIEpAUOzgsgnXcj8E xcuSG6QrJgCTBXR5cF2RGXdrXX5TrPWXLnhYJ8w6Yp4MwqoN0Q8Ct+yjpng1JSEk8TNA tpmzxXR8rNEQZasov+Dqq8v14almRNqy7jDu9UPropxb1lo+7nkXALMi+emLn7cmQYVS b/rVq3nCChhFiozYycD8o68DFaaFEmVTYNCWjZUR0uckFrGnOyCws0+ZpT8qf7lHIDy1 5bPFcx+9koaN+BvwGi47rnuZZLJ3Istbe6j8cblgSRQurZUXv9KiFvE8L+bcUZijYNYh B2tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dave.hansen@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga03.intel.com (mga03.intel.com. [134.134.136.65]) by mx.google.com with ESMTPS id d11si2842763plo.184.2019.02.14.08.55.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 08:55:33 -0800 (PST) Received-SPF: pass (google.com: domain of dave.hansen@intel.com designates 134.134.136.65 as permitted sender) client-ip=134.134.136.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dave.hansen@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=dave.hansen@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 08:55:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,369,1544515200"; d="scan'208";a="138644178" Received: from pmmonter-mobl.amr.corp.intel.com (HELO [10.254.87.236]) ([10.254.87.236]) by orsmga001.jf.intel.com with ESMTP; 14 Feb 2019 08:55:32 -0800 Subject: Re: [RFC 0/4] mm: Introduce lazy exec permission setting on a page To: Anshuman Khandual , linux-mm@kvack.org, akpm@linux-foundation.org Cc: mhocko@kernel.org, kirill@shutemov.name, kirill.shutemov@linux.intel.com, vbabka@suse.cz, will.deacon@arm.com, catalin.marinas@arm.com References: <1550045191-27483-1-git-send-email-anshuman.khandual@arm.com> <7f25d3f4-68a1-58de-1a78-1bd942e3ba2f@intel.com> <413d74d1-7d74-435c-70c0-91b8a642bf99@arm.com> From: Dave Hansen Openpgp: preference=signencrypt Autocrypt: addr=dave.hansen@intel.com; keydata= mQINBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY 2UnKuZuSBu7lgOE193+7Uks3416N2hTkyKUSNkduyoZ9F5twiBhxPJwPtn/wnch6n5RsoXsb ygOEDxLEsSk/7eyFycjE+btUtAWZtx+HseyaGfqkZK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Wplzqdb/dO28qk0bPso8+1oPO8oDhLm1+tY+cOvufXkBTm+whm +AyNTjaCRt6aSMnA/QHVGSJ8grrTJCoACVNhnXg/R0g90g8iV8Q+IBZyDkG0tBThaDdw1B2l asInUTeb9EiVfL/Zjdg5VWiF9LL7iS+9hTeVdR09vThQ/DhVbCNxVk+DtyBHsjOKifrVsYep WpRGBIAu3bK8eXtyvrw1igWTNs2wazJ71+0z2jMzbclKAyRHKU9JdN6Hkkgr2nPb561yjcB8 sIq1pFXKyO+nKy6SZYxOvHxCcjk2fkw6UmPU6/j/nQlj2lfOAgNVKuDLothIxzi8pndB8Jju KktE5HJqUUMXePkAYIxEQ0mMc8Po7tuXdejgPMwgP7x65xtfEqI0RuzbUioFltsp1jUaRwQZ MTsCeQDdjpgHsj+P2ZDeEKCbma4m6Ez/YWs4+zDm1X8uZDkZcfQlD9NldbKDJEXLIjYWo1PH hYepSffIWPyvBMBTW2W5FRjJ4vLRrJSUoEfJuPQ3vW9Y73foyo/qFoURHO48AinGPZ7PC7TF vUaNOTjKedrqHkaOcqB185ahG2had0xnFsDPlx5y Message-ID: <35b14038-379f-12fb-d943-5a083a2a7056@intel.com> Date: Thu, 14 Feb 2019 08:55:34 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <413d74d1-7d74-435c-70c0-91b8a642bf99@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: On 2/13/19 8:12 PM, Anshuman Khandual wrote: > On 02/13/2019 09:14 PM, Dave Hansen wrote: >> On 2/13/19 12:06 AM, Anshuman Khandual wrote: >>> Setting an exec permission on a page normally triggers I-cache invalidation >>> which might be expensive. I-cache invalidation is not mandatory on a given >>> page if there is no immediate exec access on it. Non-fault modification of >>> user page table from generic memory paths like migration can be improved if >>> setting of the exec permission on the page can be deferred till actual use. >>> There was a performance report [1] which highlighted the problem. >> >> How does this happen? If the page was not executed, then it'll >> (presumably) be non-present which won't require icache invalidation. >> So, this would only be for pages that have been executed (and won't >> again before the next migration), *or* for pages that were mapped >> executable but never executed. > I-cache invalidation happens while migrating a 'mapped and executable' page > irrespective whether that page was really executed for being mapped there > in the first place. Ahh, got it. I also assume that the Accessed bit on these platforms is also managed similar to how we do it on x86 such that it can't be used to drive invalidation decisions? >> Any idea which one it is? > > I am not sure about this particular reported case. But was able to reproduce > the problem through a test case where a buffer was mapped with R|W|X, get it > faulted/mapped through write, migrate and then execute from it. Could you make sure, please? Write and Execute at the same time are generally a "bad idea". Given the hardware, I'm not surprised that this problem pops up, but it would be great to find out if this is a real application, or a "doctor it hurts when I do this." >> If it's pages that got mapped in but were never executed, how did that >> happen? Was it fault-around? If so, maybe it would just be simpler to >> not do fault-around for executable pages on these platforms. > Page can get mapped through a different access (write) without being executed. > Even if it got mapped through execution and subsequent invalidation, the > invalidation does not have to be repeated again after migration without first > getting an exec access subsequently. This series just tries to hold off the > invalidation after migration till subsequent exec access. This set generally seems to be assuming an environment with "lots of migration, and not much execution". That seems like a kinda odd situation to me.