From patchwork Tue Jun 12 14:39:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 10460493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E15936020F for ; Tue, 12 Jun 2018 14:39:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D73D6287AB for ; Tue, 12 Jun 2018 14:39:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB683287E8; Tue, 12 Jun 2018 14:39:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE31A287AB for ; Tue, 12 Jun 2018 14:39:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD3076B0006; Tue, 12 Jun 2018 10:39:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D33186B000C; Tue, 12 Jun 2018 10:39:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE5ED6B0007; Tue, 12 Jun 2018 10:39:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 5BD4B6B0007 for ; Tue, 12 Jun 2018 10:39:25 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id z5-v6so12019576pfz.6 for ; Tue, 12 Jun 2018 07:39:25 -0700 (PDT) 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:from:to:cc :subject:date:message-id:in-reply-to:references; bh=xTQe7cymsDO8mFdVXqpOxhRPTQ5YUGDB6wkAiyI6Tso=; b=g1oBETqjQArcQ+sDaWVD1OHdwbPlCGgTXStY1InL5L7w6a/DFjGGF030rpdfS6/9gZ nbgPmNDyuesTIxJwOLJF//VRwdRE5MTs1UWP3OEBKfMvGTwS0IaJYo+PJaZV2ub0QB0q FE96kPADS8M7wy6rybQD6KKR0stxB6v/WozbZfnpLAKEtmthcstIVMnfIYBC3FQttXTx FR12uRFGCyjzU9f/W/ZF3BDzn3cvVxkiu9X/k2v4yt6OcnG3J1bUXxMo5iXiJbLuABTU Lf1BpCI4gjMxsZ30fAbj32X/rJbxkUk3vcdOWdyLRiqfz4lTxULoJpKUXdaXu/nNuctr i2tQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APt69E03K/aRlQk5R0RWHVTuEZjBJyqP2H1YTkVvvf+1xVKDdokPyyM2 kFeOXOcIzKujXrwMkhkceILaMjX1ECpzL9uz0JkNBQk3rwlM30rwGwYrkPLR5FCsZ5zpRDRkakj 1oo2Prt2rQy1uRi6KWIsg6z18j9jFkYgrzuIBHwLUD/zlEVrWwsAZ8yA6xaZ4RzmpDw== X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr719737pls.342.1528814365069; Tue, 12 Jun 2018 07:39:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLsIkRDV47s1eIbzrOqT6OkD22pAvRgvzdbJeluS19WTB0KT4RTIID8zWypTIvlxgHn1GFJ X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr719679pls.342.1528814364179; Tue, 12 Jun 2018 07:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528814364; cv=none; d=google.com; s=arc-20160816; b=Lksv8PVziCSHJxiuL3kSmmPj1t/i1jZN7bno5KDLCuR+OpTPLiYX6OTl7H9kbCfeSb sTuOMZDtH++FjQKBYBxDh0ZgYCuQbeHkPw8zJmATyPZoShud4/QqZPrzcMPoBcXE5Cgr YNkQYBw1D93rFzwgCR2NTjuSggVkkgFyTWfxZ2dLaSFRsEgsM43xxDAoKtLHo1dJqdCd CeoZHPsdE+c22IlOCa4Lv8OO+5QS+A7L22r6C6kyi/GuZv0oCGT5AhcPwuXZ4Hh7Skc8 SjkOzDDQbRkK5zP6aZO7mhC8tfUvRlXu2S9aXjaIPNPI2y267QsiEmzlB61fvGDmXMs3 E2lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xTQe7cymsDO8mFdVXqpOxhRPTQ5YUGDB6wkAiyI6Tso=; b=gsuA8MuTajUnxrOC/YH0o/OvheNZRvfZkV5441zi3tPmvXEyYV+iXYG9A+tLk103AI DCIFxuT+Yl5lu5++Y2oEZEk6tJ0YW9H+J4JdgYdfsy/EtgYT6kx3efoMVlZ7f9WookU7 NW+Sm+17oMD2MyrKTxKDRchBA8FjwLIuuZYgevXBt+l3V90XJsxd0yuowoQexREQOAb+ bT2FSjFgPqmnW/Qq6DV3vZx+E1jeSyMoBsQhcHAY2WKsGeiL7HsqGmieoIHft9a9d0Oc 5xWpT+v9O2YXcJUn+GvjOeMIHZ9/ntnu6U54HNcCf8fFPSiaWGU/SyOdtc1U8HXLgbGq iOXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTPS id v40-v6si235817pgn.467.2018.06.12.07.39.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 07:39:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.93 as permitted sender) client-ip=192.55.52.93; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (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 orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.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> 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: X-Virus-Scanned: ClamAV using ClamSMTP 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); }