Received: by 10.213.65.68 with SMTP id h4csp641556imn; Wed, 28 Mar 2018 10:01:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx486fSS9JrcUdxl/ZjR5tM64Bex6G1BF86Dwisu4pOw0YkHjSCVfNeV++ZsHrzrsWvPvhb82 X-Received: by 10.98.29.145 with SMTP id d139mr3564053pfd.165.1522256500330; Wed, 28 Mar 2018 10:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522256500; cv=none; d=google.com; s=arc-20160816; b=F7P/YP5dpJNBrIGnRwGV321GO/NK+LcB11WPY9OOWRTGxQeKg2U34JriPIbgrA310Q +nsk4Pd96fFI87EVZZNq6dXd8qMaPUs9WQARne7pBe7zY5bs4laMAqWBXNhOJdMxJ+aZ I4i4RT6M1P4KxdCAD5FpctqfBtrZ6lFZoypqXlR91a3KhCIWR1vErlKv72AakUYwZYce caFsfNGWzA4A5CuxEs+AE8bgQCaFiRP+QzSV+ytraLgo5XJyUuzDOqgwA4yVNJM9s622 owUylD/xSgcyokO9HqCapnyfToDfSd1y+E+NL9SAK5J/UIj+y+25NVkb6IwDLtRCG8SD CnCA== 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=sFldkwryXGWAXF6ymCZSPQdAZXq35U+oWig8knkN27g=; b=tWuDtHYZrOs53So8d8PReCc1qC//2q3bhwdL7iK/vqzizdHfOUhCzImbnmnmgx5J/o aZ4dyY9BOVK/bpUQR7KFpAqCABXkRWWtRVCqrZ20uzojiIa5QznZcWOrAQSKM56zALwr PjVggQcsIqKPeAIigx9WltnY7Cu2iUs+0fF4T4tW3JZttePe0Pn8id7viGgq+rPS0bS7 eUeXqcT01nfI+IwYidsG+Vnl/TKHBU2POrfKMslaojjFZM6m/UGGJB/QD/m1aP8RWg48 LYMtSfcct58cxTJab9E0pFemYW4/GyqKFcjLLkx07wpNqjl5S7g+3m2LQZHd80R7azYE yyXQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si2763575pge.138.2018.03.28.10.01.19; Wed, 28 Mar 2018 10:01:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753311AbeC1Q7L (ORCPT + 99 others); Wed, 28 Mar 2018 12:59:11 -0400 Received: from mga12.intel.com ([192.55.52.136]:20183 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751434AbeC1Qzt (ORCPT ); Wed, 28 Mar 2018 12:55:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 09:55:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,372,1517904000"; d="scan'208";a="37608758" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 28 Mar 2018 09:55:47 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 5C6ED347; Wed, 28 Mar 2018 19:55:43 +0300 (EEST) From: "Kirill A. Shutemov" To: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky Cc: Dave Hansen , Kai Huang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" Subject: [PATCHv2 05/14] mm/khugepaged: Do not collapse pages in encrypted VMAs Date: Wed, 28 Mar 2018 19:55:31 +0300 Message-Id: <20180328165540.648-6-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180328165540.648-1-kirill.shutemov@linux.intel.com> References: <20180328165540.648-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 6c50f77c75d5..b6a72eb82f4b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1479,6 +1479,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 e42568284e06..42f33fd526a0 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.16.2