From patchwork Tue Jul 17 11:20:14 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: 10528997 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 C4EB6600F4 for ; Tue, 17 Jul 2018 11:21:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3AD028BAB for ; Tue, 17 Jul 2018 11:21:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7A0228C3F; Tue, 17 Jul 2018 11:21:50 +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=unavailable 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 4DD2F28BAB for ; Tue, 17 Jul 2018 11:21:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D5A36B000D; Tue, 17 Jul 2018 07:21:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 483F26B0008; Tue, 17 Jul 2018 07:21:47 -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 372E06B000D; Tue, 17 Jul 2018 07:21:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id EC7E26B0006 for ; Tue, 17 Jul 2018 07:21:46 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id w14-v6so391669pfn.13 for ; Tue, 17 Jul 2018 04:21:46 -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=tL5Meckb5kr8LRcF0rqHZgkyn3KGinqxWE4pFYGX7wQ=; b=p5VxsB1XfAdBqB19hoMhhlsz/Y8qbYKhTVaHD8g1uIML8aV4nFr+j4h9foJkOQXOCD GlI6x50Ce1pkQIu+IP/q/rim7nOiB6h5ZAxucSle2Bs5E9nPaULjMH9CjPvgoLLNeUJV ir8xwD0bUfWMHtW5jmb5SF1K7ZDZcOleGbX62mqah4crD90H4Y8Yw2knISCKwFW7osMU gQHB4Q13pJqnFRBraue1okJPm/5dxLoPK1NzhYyhkjh/UGm3w0coOd6D4KQBg1bF7tzG zL+t+OfRRkofmKU87bhHci9OUZqxK75y2p2v8Uap4/r0fmslgnXPwk9UtXO/yLA+c1wg Bp3Q== 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.120 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: AOUpUlGntDKXhv5OsAq5vDRxLE0Anh47h4l5qtqmohdgUGc3S4eyzLwU mkq1IBekGE67/Vk82nFbgXEOiBMlBkRhS0FofH4VLyhzcaT/mdmrfHJtI36ahUDhOf1qAjAQscy DFG9NVas/yPOfPrS1oPAzfD9c5K1oa1vVu4dN237SL4O6a+HQ5MpFUmRHHVeQFrF2cw== X-Received: by 2002:a17:902:8f8e:: with SMTP id z14-v6mr1219834plo.139.1531826506650; Tue, 17 Jul 2018 04:21:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdMiMbOBw/E0zsVcEvz2dflFAc3fKtI71n+5ia4TbI+yD2bdcyaJqyUaSTf4tTtE/L43uSu X-Received: by 2002:a17:902:8f8e:: with SMTP id z14-v6mr1219788plo.139.1531826505886; Tue, 17 Jul 2018 04:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531826505; cv=none; d=google.com; s=arc-20160816; b=YHt0LJN1/qlGOL3GwINhiJOZM29VlHOUVRlcmcqd/3csmOMnp21TPz0sBpM9XDzjk2 tQ3ZZuV4ke3m8A/3eUF1qjIZEmzNwhNA9Gec7lI19AHUbGaOarIEEoh+XoDpv9DrK7zG kpL5/UC0A0Recce7bJ7MNkgIta3RDa8/DuCOXBZn3+0KFDwX66D836BHFzFBhCPeLVrw KR6/Kvwy5opeN7GIBw14IBmbQVu3BuAlws2Ct/vJ4zN1l9c9tipC54H/lnm0Wmi1xRSw YKfGEUm1JphPFoFMSITNCvxCjEbTU0Y11ydxLBRx3NQ38gycxV3e2JqY3d8mnGAb3yWo yJvw== 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=tL5Meckb5kr8LRcF0rqHZgkyn3KGinqxWE4pFYGX7wQ=; b=qa3HpkYN78mvp9YKUWXre+3H+fb/g74yXazFhhvKZJFql/zEX2eBF5OQSo60HWKSX/ HVY+YZZWYlT96UKNC9t6mRhFzjcmFBgpTynFCFsZCdTZa670yyA6xYAA5mupWZCfNiTD X5arcWqSgqp+KdSQQ2743r3D0/M3FMB3ehGLde1U9I+8uWd3m49WispE1R/bLDraElvs vPLoqr40H+wU89ciWAKZoye1TWRn8C1n+da/2GEGNvHg94jY1U/IX0IBFX2dZH75qTek 45cj+nR4U19DB/yN0TpwuI5Vr985BBe7DjSAUuX9dvPcEjzKRmC4iCKhY3bly3vVxW1K ySLA== 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.120 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga04.intel.com (mga04.intel.com. [192.55.52.120]) by mx.google.com with ESMTPS id r21-v6si791980pgu.55.2018.07.17.04.21.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jul 2018 04:21:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.120 as permitted sender) client-ip=192.55.52.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.120 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 orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 04:21:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,365,1526367600"; d="scan'208";a="57508411" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 17 Jul 2018 04:21:42 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id D78EC32F; Tue, 17 Jul 2018 14:21:48 +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: [PATCHv5 04/19] mm/page_alloc: Unify alloc_hugepage_vma() Date: Tue, 17 Jul 2018 14:20:14 +0300 Message-Id: <20180717112029.42378-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> References: <20180717112029.42378-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 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 a6afcec53795..66f395737990 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -494,21 +494,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);