Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5428327imm; Tue, 12 Jun 2018 07:44:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIaB9qI3jyU3y584YmKTLuynB9xiD5Vj04KV58AFfjl/VG4RyKN2aJR4Gxfd7xsdWkjePWB X-Received: by 2002:a65:630b:: with SMTP id g11-v6mr555472pgv.303.1528814655938; Tue, 12 Jun 2018 07:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528814655; cv=none; d=google.com; s=arc-20160816; b=bj1HBS5zrcWSwQxn4Gq75pl29mmxevzPu/lsq7tQ18K0wsTcjStvJsjOWqegifWijJ JSqguJMr3tQYrqfNSEwRhsu3Br0It3ucrAElQBcE+fRCHem1ZY0n5YqA2zxROaSzQoxo I+IkfFREu9HqmUlBqKRdS3m5aBPiLA+oIRP9r0hv+n3csiNHNjLBXVas/Qzb9jOX1KLO vA9cAO5pjFAruokpVZKu5jQK69tvmtuJZF1GDHUtEyfAvXqGCO4fMi3ad5WbxSkFRIyg GfHq4X9qnqNkxAT863ATvfcKKRiRefa9XEAekqHfKDpZYaXME8qn5JmGozw4CwXKfC8d 6FLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=xTQe7cymsDO8mFdVXqpOxhRPTQ5YUGDB6wkAiyI6Tso=; b=eqdL8rW8k1b6ASy1mq4MQ1b+Xb1y9e89ma+G8clWg/bfmSJUI+in1zu8z8VEnJwdkc 8WsXu2n1v3NWx3puRq20ucbDJkeBEbVIaaA5ZOxTxBzU4F8tp1oo2mj97yvRkVQIb5qV ujHtd2oM7PQL8bvEz8H4jSCIM+41/5dYaTMzPnuGm3ly5EdUIky5fQOXxBl3XMML0JWS /4gzUoY5GxxEHimWdYOsDcAUrkFWizQWj7z7j0Zb6qG00F8vkkunCz8QTEgSVqreKMSx XXsFER0CE1uQ5L0fM5D4WMq/yTp3JcFWrGOmv985+SgHanIAAmlqDlWGsQvrzB6LNKMz 5L/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si282814plv.16.2018.06.12.07.44.01; Tue, 12 Jun 2018 07:44:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934232AbeFLOj1 (ORCPT + 99 others); Tue, 12 Jun 2018 10:39:27 -0400 Received: from mga03.intel.com ([134.134.136.65]:64427 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933408AbeFLOjX (ORCPT ); Tue, 12 Jun 2018 10:39:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2018 07:39:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,215,1526367600"; d="scan'208";a="231956830" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 12 Jun 2018 07:39:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 8E21EF5; Tue, 12 Jun 2018 17:39:20 +0300 (EEST) From: "Kirill A. Shutemov" To: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky Cc: Dave Hansen , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCHv3 02/17] mm/khugepaged: Do not collapse pages in encrypted VMAs Date: Tue, 12 Jun 2018 17:39:00 +0300 Message-Id: <20180612143915.68065-3-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pages for encrypted VMAs have to be allocated in a special way: we would need to propagate down not only desired NUMA node but also whether the page is encrypted. It complicates not-so-trivial routine of huge page allocation in khugepaged even more. It also puts more pressure on page allocator: we cannot re-use pages allocated for encrypted VMA to collapse page in unencrypted one or vice versa. I think for now it worth skipping encrypted VMAs. We can return to this topic later. Signed-off-by: Kirill A. Shutemov --- include/linux/mm.h | 7 +++++++ mm/khugepaged.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1c3c15f37ed6..435b053c457c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1492,6 +1492,13 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) return !vma->vm_ops; } +#ifndef vma_is_encrypted +static inline bool vma_is_encrypted(struct vm_area_struct *vma) +{ + return false; +} +#endif + #ifndef vma_keyid static inline int vma_keyid(struct vm_area_struct *vma) { diff --git a/mm/khugepaged.c b/mm/khugepaged.c index d7b2a4bf8671..a03b40bef033 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -835,6 +835,8 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) return false; if (is_vma_temporary_stack(vma)) return false; + if (vma_is_encrypted(vma)) + return false; return !(vma->vm_flags & VM_NO_KHUGEPAGED); } -- 2.17.1