Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5289596yba; Wed, 8 May 2019 10:44:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqymw6qZSamKvsVmo7lP0Qj3DsX2A0VbapD1IPGFlrBJAqjHQwqxjjg/cJlazHouKDeBHr0r X-Received: by 2002:a17:902:163:: with SMTP id 90mr35242074plb.212.1557337497436; Wed, 08 May 2019 10:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557337497; cv=none; d=google.com; s=arc-20160816; b=k3iahsw62fXgZ0MlogaNUzkN65+DB02NJlZbZ88P/sSfyp5vrfFQd3JcHeTNGW1nv1 NNxyHP3iiku3c3SxmZ5uBKlwaHO3xPpBq4nHcwswxsvq4Ofb1qQ8wxl9eis4n/MA80Ww BvFx0UcaHZM2B8wq7Z0Kp4XOOpnwWyWeuhRB/FQPMfYBj3+r9LKViJ6M2EywGIeksUvE 1N3PHtf/6oIHzyjwBOTZ9MH8t2qJdMHI6p/gTgWlNQy1z6q67CxL0p572kDUxv6KxvY1 ke5Kk5po07ndltKZ1x2C7qhKKjh45w7UaNqCnU5XGakvbthhfstgrqETJHm3mUdHz6dE 7piA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=49lJbfvv15ZcHha4FIriTS/Z7arlGEdmOhAM+djd50M=; b=OHHGzM87ZdcNGuq6dBQBY8OFkzAVR/oVSgtlLkpWkQzu3BB+KuJBIl75ubooAejrTF rhQ9afrqvEUnDM2/Ao5ce/wwb+irKjwNesJNCiphrDlqk11t9v5uGhWCovb4J4mqycnG eZule52wIHbFbfRJY+ncjCShqqXPpBuN4E/cEOu2kVYTlXg/CiH5l7mBZd5GO0wBk4cj kDKu+PZG/a3n/h4gM+XrrAmh9pMAc8wTsVFaL7J5ldCitOxJZJgKjgMJDwz24QgjiS5Z Kat4/ToKL8lmgG1FwRYf52KBcYva5/GrctYNtba2rEftRMH2ui+oBtQ5nrw3sddIu22Y pnVQ== 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 64si25100316plk.399.2019.05.08.10.44.42; Wed, 08 May 2019 10:44:57 -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 S1728088AbfEHOwW (ORCPT + 99 others); Wed, 8 May 2019 10:52:22 -0400 Received: from mga14.intel.com ([192.55.52.115]:48394 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727315AbfEHOof (ORCPT ); Wed, 8 May 2019 10:44:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 07:44:34 -0700 X-ExtLoop1: 1 Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 08 May 2019 07:44:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id C283D3D1; Wed, 8 May 2019 17:44:28 +0300 (EEST) From: "Kirill A. Shutemov" To: Andrew Morton , x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , David Howells Cc: Kees Cook , Dave Hansen , Kai Huang , Jacob Pan , Alison Schofield , linux-mm@kvack.org, kvm@vger.kernel.org, keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH, RFC 04/62] mm/page_alloc: Unify alloc_hugepage_vma() Date: Wed, 8 May 2019 17:43:24 +0300 Message-Id: <20190508144422.13171-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190508144422.13171-1-kirill.shutemov@linux.intel.com> References: <20190508144422.13171-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We don't need to have separate implementations of alloc_hugepage_vma() for NUMA and non-NUMA. Using variant based on alloc_pages_vma() we would cover both cases. This is preparation patch for allocation encrypted pages. alloc_pages_vma() will handle allocation of encrypted pages. With this change we don' t need to cover alloc_hugepage_vma() separately. The change makes typo in Alpha's implementation of __alloc_zeroed_user_highpage() visible. Fix it too. Signed-off-by: Kirill A. Shutemov --- arch/alpha/include/asm/page.h | 2 +- include/linux/gfp.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h index f3fb2848470a..9a6fbb5269f3 100644 --- a/arch/alpha/include/asm/page.h +++ b/arch/alpha/include/asm/page.h @@ -18,7 +18,7 @@ extern void clear_page(void *page); #define clear_user_page(page, vaddr, pg) clear_page(page) #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ - alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr) + alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE extern void copy_page(void * _to, void * _from); diff --git a/include/linux/gfp.h b/include/linux/gfp.h index fdab7de7490d..b101aa294157 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -511,21 +511,19 @@ alloc_pages(gfp_t gfp_mask, unsigned int order) extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, struct vm_area_struct *vma, unsigned long addr, int node, bool hugepage); -#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ - alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true) #else #define alloc_pages(gfp_mask, order) \ alloc_pages_node(numa_node_id(), gfp_mask, order) #define alloc_pages_vma(gfp_mask, order, vma, addr, node, false)\ alloc_pages(gfp_mask, order) -#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ - alloc_pages(gfp_mask, order) #endif #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) #define alloc_page_vma(gfp_mask, vma, addr) \ alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id(), false) #define alloc_page_vma_node(gfp_mask, vma, addr, node) \ alloc_pages_vma(gfp_mask, 0, vma, addr, node, false) +#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ + alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true) extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); extern unsigned long get_zeroed_page(gfp_t gfp_mask); -- 2.20.1