From patchwork Tue Jul 31 06:01:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66BB914E0 for ; Tue, 31 Jul 2018 06:04:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54CD2295B0 for ; Tue, 31 Jul 2018 06:04:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4700029C5D; Tue, 31 Jul 2018 06:04:11 +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 D649E295B0 for ; Tue, 31 Jul 2018 06:04:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D98E6B0007; Tue, 31 Jul 2018 02:04:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 08AC96B0008; Tue, 31 Jul 2018 02:04:10 -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 EE30A6B000A; Tue, 31 Jul 2018 02:04:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 966DB6B0007 for ; Tue, 31 Jul 2018 02:04:09 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id u9-v6so371164wmc.8 for ; Mon, 30 Jul 2018 23:04:09 -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=o/AgyAG4mUG53I1V9hAwgzNadjNMbd6kB7OlRt/NDDg=; b=Xg7f+9CmD1en824OzlKFafm4jgkUUYqYhhj6SxxUhDFRRMm66htZUpKIN3xN+CoVLa 7Uri8Dyl5AEdh0HtRPG8w2GY2/c8+gyWlxme18rLCRrpLA96GQF4qbotYVwig9gRdECJ r+6BpARPmrAMUHZc7OvCx/cQC7UI6C6ABEOdF6N9GtnQqvxYduEBe05I04nQgHzvmom/ q5w3muKcLxP0clE8/WoD7WfoJZVULP/Z1oEMRDdM87GMuc1uoWvKTmaXmDO/I6kQU2cI YU/1xq+mRNe9YaPL8KGNjJocTXkJ7iESK7bfU51C8Mt29/+t/G7JwI4m4xtPsAnLXqC0 DlJA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlE5Utk1DLI92wOapp89+bxdmhD/vH9dbSFoJm176sh+F44fDR9T KukGjAQdHf5gEYCyuHK1K9j1opj3CMXLzzK8su+uHOiVHUuC4RHxsGFuJ9KMDw0SICePE2GYIph QRtQ+QkvIMr73Uir7zNmMpn+HuZTMSMV/fjb7H6vHKwf+YGOPg8PAIX2vsn373yQ= X-Received: by 2002:adf:f342:: with SMTP id e2-v6mr19754411wrp.161.1533017049202; Mon, 30 Jul 2018 23:04:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsiOq+JKttHLBVewjhOn0o/16sXEZCmUuXsAq+gD74gjTKidKU+8Oxr22o6bTWHeiITcTo X-Received: by 2002:adf:f342:: with SMTP id e2-v6mr19754376wrp.161.1533017048560; Mon, 30 Jul 2018 23:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017048; cv=none; d=google.com; s=arc-20160816; b=IFWFacaYB8JpSyX+djHl0QsBioPxzAp5B1KpqrLAJDgMvKbnI5js6fVDyuHt99gTXk ycioRlbdF4BGgm7BjnZqQoYcrDB2Iz2bIsWR7CBiVBlovptfRrY08+WO2bMYo3OyDqi+ W6AW4+AK7DBcyqKNtbzoRIOlQMaG+3k+yk4ZREuTr4kRGLip8GYr+RyFRmTG2HflwjdV 5FsxM9gsEUnvzuJgnpU6ty/CSl/MNRzywpcdaDWWiKQkQVqnCtBU6Jy0wEVv6eALGC4u z4MKQjgcLahaJqdpNfb8LnT97U5DyyKh7W33HGuW787rCOTo0I4o2y9ZKtF/yz4Jh7CR GxaQ== 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=o/AgyAG4mUG53I1V9hAwgzNadjNMbd6kB7OlRt/NDDg=; b=t4yjbCJ++T8/xp443U+UdXo5em3QjntVXGtsh6JIFXLCzcjOwdOpfVUhUzT6/lupNG WS1QiSS7zv5rTcvsq59hTxGvurChzzUKWloDgruOf6iUCycF4b4hLHeIZhnhHcbkBlPY YlccWC42euFQk75OA7ssOE/+kDjL/ioUdfclZlmm0mDxsW2foPOdn+zYRCmt0dEhnqEv VrOl2IgJskT/hDopnDM9lcyH/wGQA9wM8XVYLORUqnrv9ZdByGoMPskB5NoMx1F4b+K2 u6UlD5nka29adox3F6+Lm90dvTBHvfSbO1yx4WHTqrE+4OpTkv3sEzNPGYHiEDI1dHvH nWEA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay10.mail.gandi.net (relay10.mail.gandi.net. [217.70.178.230]) by mx.google.com with ESMTPS id 192-v6si1037304wmv.14.2018.07.30.23.04.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:04:08 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.178.230; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 0DBF3240005; Tue, 31 Jul 2018 06:03:59 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 01/11] hugetlb: Harmonize hugetlb.h arch specific defines with pgtable.h Date: Tue, 31 Jul 2018 06:01:45 +0000 Message-Id: <20180731060155.16915-2-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 asm-generic/hugetlb.h proposes generic implementations of hugetlb related functions: use __HAVE_ARCH_HUGE* defines in order to make arch specific implementations of hugetlb functions consistent with pgtable.h scheme. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm64/include/asm/hugetlb.h | 2 +- include/asm-generic/hugetlb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index e73f68569624..3fcf14663dfa 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -81,9 +81,9 @@ extern void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); extern void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep); +#define __HAVE_ARCH_HUGE_PTE_CLEAR extern void huge_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long sz); -#define huge_pte_clear huge_pte_clear extern void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned long sz); #define set_huge_swap_pte_at set_huge_swap_pte_at diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 9d0cde8ab716..3da7cff52360 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -32,7 +32,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) return pte_modify(pte, newprot); } -#ifndef huge_pte_clear +#ifndef __HAVE_ARCH_HUGE_PTE_CLEAR static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long sz) { From patchwork Tue Jul 31 06:01:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B06841708 for ; Tue, 31 Jul 2018 06:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B9CF295B0 for ; Tue, 31 Jul 2018 06:05:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F4362A40A; Tue, 31 Jul 2018 06:05:18 +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 C9CF3295B0 for ; Tue, 31 Jul 2018 06:05:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 040606B000A; Tue, 31 Jul 2018 02:05:17 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F09A86B000C; Tue, 31 Jul 2018 02:05:16 -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 DD1266B000D; Tue, 31 Jul 2018 02:05:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 7E5006B000A for ; Tue, 31 Jul 2018 02:05:16 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id f13-v6so944268wmb.4 for ; Mon, 30 Jul 2018 23:05:16 -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=0uST+XMKd0Si+s4oYG7j9OxqwyJ+iBkIUJD92u9UEvE=; b=QWgcnUbQvQM148d044jdOOY2AddOaFHh2qQSkr4y+/elqYc2ZaUkt8g+qMR72Et1uZ bSjk1MjEEIjMF6ZeXFGmutRu4H90LNTwWr4oASgUbFESPkqu6ckXxjGy9QUV4fYABJSF 2n3ZyICLbngsS+Se/lZJcw/bxDSqvqVdHuJQjj8auuW9Sxgf7yILXY+eHZX+a0XbgCW6 +6u/sIU+zmw3V9V1Xr7TVCy+FXq8T7AnxYPRilOlmjH019rN7HkwVNkLlk+yYutXkPEH H0wi2OaQAXlwvLwJ5IopWt7EGgaGtE/xfujPUTtxFGWIS0oTPjcLczPIItmi/jrqhPDJ CSsA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlGWYIjtzXwJ8SAmTdmo+QiWyQevIlKses0sF4WJWE1RqeYyZ5OI k/TUZ+us12Ru9RtcSSOiQTc4Eyg1EWu49puc2My6kS2zYHPlyeDcKuxSkcYNtGTIpVVEtvZj33S GbrChMOmSmOUCiE0D6EiMXfrW3KjBFh3LNYTe8UNbID0XanLaGg5rDNC+S/XWHSc= X-Received: by 2002:a5d:550a:: with SMTP id b10-v6mr20620936wrv.228.1533017116019; Mon, 30 Jul 2018 23:05:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYeuD1drJI4aoU5NhtUmDPHK1xq5t867ksw66w7/Wb9m+p68EHr9GEt5ovhZpoABWWa9BJ X-Received: by 2002:a5d:550a:: with SMTP id b10-v6mr20620879wrv.228.1533017114592; Mon, 30 Jul 2018 23:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017114; cv=none; d=google.com; s=arc-20160816; b=oHhNRTCe2aq/f5tiSMi5wKr2lobhzSeE1fmiovzgxVWVqjHkNKF8d9XZSAyzfOt5CC 4rBiJ8+aCkTlWTNaGWk1BFCE+BOSDXJywV0aNC23pGJ50kT4e94aBXii0zgmp/o7YK5L 03PrdMKi7ELZ1B5wRgYCSEQRkwz3tpo6g7y4DE3jl4eGhFauyD8KNNTvXeGwwGWoBgUs YZHGB0D5L/1hdqWJsyc5d+50WjKuXer9YdrM01/Z+d2PEjvN+kZF+FCoB547gzsdckHL VNfqdRC4lY0u9eGazPq/G1uXmN/ruNX7wqE+v1gLYtn8/Lp7t73tWRsDJvUUd7db8HGg O1xA== 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=0uST+XMKd0Si+s4oYG7j9OxqwyJ+iBkIUJD92u9UEvE=; b=UPUTMROuztgclcE14If+Ggcy/cvVx6iyN/H4C/PP0hYNh6DftHDq34UJ3o8eeS46Y/ XJ8qSkvv9jtqBd88P0vuVwD+fqTs7AIZOkb6kuLjS51ljJ89UDqJLtQdnudFsgwFbUmv 8voyN8bIGC4s59IgTO/SgYqMqGsCxEqMTwihZ4XGAHiRsXJqa7MD2jA/nP7HrCMPePeu 8n+F32GPUbahY7+6r52JqIbypHG7Jwa7i9Ugyvj4Qi0FmzMHVGqmIT7mWKyy+HPmGtb7 ne95zKahNeL3Xibg2YdlRWRxpNOTbqzmP/mlye20wQxtNy3qh9w5HxIx8DZ/HNX+KQeU 8CPA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay10.mail.gandi.net (relay10.mail.gandi.net. [217.70.178.230]) by mx.google.com with ESMTPS id q11-v6si8968884wrv.47.2018.07.30.23.05.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:05:14 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.178.230; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.178.230 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id CEE4924000A; Tue, 31 Jul 2018 06:05:08 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 02/11] hugetlb: Introduce generic version of hugetlb_free_pgd_range Date: Tue, 31 Jul 2018 06:01:46 +0000 Message-Id: <20180731060155.16915-3-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, arm64, mips, parisc, sh, x86 architectures use the same version of hugetlb_free_pgd_range, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb.h | 9 --------- arch/arm64/include/asm/hugetlb.h | 10 ---------- arch/ia64/include/asm/hugetlb.h | 5 +++-- arch/mips/include/asm/hugetlb.h | 13 ++----------- arch/parisc/include/asm/hugetlb.h | 12 ++---------- arch/powerpc/include/asm/hugetlb.h | 4 +++- arch/sh/include/asm/hugetlb.h | 12 ++---------- arch/sparc/include/asm/hugetlb.h | 4 +++- arch/x86/include/asm/hugetlb.h | 8 -------- include/asm-generic/hugetlb.h | 11 +++++++++++ 10 files changed, 26 insertions(+), 62 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index 7d26f6c4f0f5..537660891f9f 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -27,15 +27,6 @@ #include -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 3fcf14663dfa..4af1a800a900 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -25,16 +25,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return READ_ONCE(*ptep); } - - -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, unsigned long len) { diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 74d2a5540aaf..afe9fa4d969b 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -3,9 +3,8 @@ #define _ASM_IA64_HUGETLB_H #include -#include - +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); @@ -70,4 +69,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* _ASM_IA64_HUGETLB_H */ diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 982bc0685330..53764050243e 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -10,8 +10,6 @@ #define __ASM_HUGETLB_H #include -#include - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, @@ -38,15 +36,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, - unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { @@ -114,4 +103,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* __ASM_HUGETLB_H */ diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 58e0f4620426..28c23b68d38d 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -3,8 +3,6 @@ #define _ASM_PARISC64_HUGETLB_H #include -#include - void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); @@ -32,14 +30,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { @@ -71,4 +61,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #endif /* _ASM_PARISC64_HUGETLB_H */ diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 3225eb6402cc..a7d5c739df9b 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -4,7 +4,6 @@ #ifdef CONFIG_HUGETLB_PAGE #include -#include extern struct kmem_cache *hugepte_cache; @@ -113,6 +112,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr); #endif +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); @@ -179,6 +179,8 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#include + #else /* ! CONFIG_HUGETLB_PAGE */ static inline void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr) diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 735939c0f513..f6a51b609409 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -4,8 +4,6 @@ #include #include -#include - static inline int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, @@ -27,14 +25,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { @@ -85,4 +75,6 @@ static inline void arch_clear_hugepage_flags(struct page *page) clear_bit(PG_dcache_clean, &page->flags); } +#include + #endif /* _ASM_SH_HUGETLB_H */ diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 300557c66698..59d89b52ccb7 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -3,7 +3,6 @@ #define _ASM_SPARC64_HUGETLB_H #include -#include #ifdef CONFIG_HUGETLB_PAGE struct pud_huge_patch_entry { @@ -84,8 +83,11 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } +#define __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); +#include + #endif /* _ASM_SPARC64_HUGETLB_H */ diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 5ed826da5e07..398da3b3414c 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,14 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 3da7cff52360..c697ca9dda18 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -40,4 +40,15 @@ static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, } #endif +#ifndef __HAVE_ARCH_HUGETLB_FREE_PGD_RANGE +static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, + unsigned long addr, unsigned long end, + unsigned long floor, unsigned long ceiling) +{ + free_pgd_range(tlb, addr, end, floor, ceiling); +} + + +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5589B1708 for ; Tue, 31 Jul 2018 06:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4401529E79 for ; Tue, 31 Jul 2018 06:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 366442A40A; Tue, 31 Jul 2018 06:06:28 +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 6F90429E79 for ; Tue, 31 Jul 2018 06:06:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DADF6B000D; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 988426B000E; Tue, 31 Jul 2018 02:06:26 -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 852C26B0010; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 268B96B000D for ; Tue, 31 Jul 2018 02:06:26 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id t10-v6so11049738wrs.17 for ; Mon, 30 Jul 2018 23:06:26 -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=d2/U4BnIhgPjVHqnWxAcljToy+n42S4aRLnCPvxsOoE=; b=bHamI3vtQX6qkZziR+TVwt6B2HZSHgib4khEu4EAUjBN0i5gJ8ZTyXXxfpiFm3eY6e e6tsmLqlV19DfHJuygRvepUPZIdT0kwoDxN0lvn/UVulYqQ3tEhHKqsOmZhesK9whKN8 JaTtUD00zGhf+3/igO3xyT1ZVkSFHGgNhb+k7Op/hMjZFrNTEGTrV3EkhauDlZFUwoAQ X6m/Re9t0mkudpiNJ61s6Vxe/PpTqiX2wQnBtTZG1Joewt8/t7Na4CGT1pjlsSgdsYi2 RKdxB/DB7Tq7Q8D0ZfR0e/p3+/Sm102aWHck9zWAyg5eRH73fYzskdLTR54GWphIgFVu /dVg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEeJ30FhYyNvmDkbycXm7tVTYtMyLvlqDAF1C1I2yOTRLcWbiYK NJMjZh9V2sU9DPIRHcUM/pHullVY2Y5fIqDqhpoyM3TLCccXP+pn/JMr8a6Yxj36E7V1wkKkDQz LHar95SSEwftIAMWQW51wqGygCwvT3PRPHULA6wlpEgPx64QqvcZoddSG+fBO81g= X-Received: by 2002:a1c:98a:: with SMTP id 132-v6mr1315863wmj.86.1533017185610; Mon, 30 Jul 2018 23:06:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfZusR4f0krGJdYXlC6FBEYna0Tq2C0jgXaRUcYM8TlSqTPCiQkoJ0OhOPXCAZ5wXmOGWAc X-Received: by 2002:a1c:98a:: with SMTP id 132-v6mr1315834wmj.86.1533017184639; Mon, 30 Jul 2018 23:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017184; cv=none; d=google.com; s=arc-20160816; b=s7OWMwSb6E24IPvAiRsmnzTHMU8FCnCZK55dTlrIBsq4WVUw9zpmeGZTJey/3FOnb/ 3mYI86Tt9Kygprtuvv3O7c3OZ/hUHfcaxnivmNtkQZYqVI2kSL8r5x2Ys1MhrCWCuMON 0NCRQi0vTyii91YXokYbqxkg9gZP6RDYLP+fCDsOzmQ1I33VvISJeIeAjAxNNrCfCpT3 AkOtK1dj8n3MmpkbgzJSKYX+C4tS3/VACJnhUfx0VrwBsnjUiC/QqKs4QQOfYRCb8lds l5W1xaeW41AxqZcD+vgugge8vRIt+PPSZVQ3+KjK+wxFS6jJo/VlGuzlG8j6TFIy2kgB qynQ== 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=d2/U4BnIhgPjVHqnWxAcljToy+n42S4aRLnCPvxsOoE=; b=Es1Smcy/rAfKzWvtRX5bN2sfJnbWkDVBGY870+rjO2BjjtXJ4o6LyUAsm5+1QkaPKL pYuTmlmitWHZ+a9AAdnqEWLM6Bqbs7hgqCrDTymRDXdYX6CPnPW4Rm9CZNLPAzHoeiht /2TVyv9QKY3Qp/p4iWxIAiFCydet/t8gDmzz0/VqAxH33H7fzNYZj0vZXXUTDpmMAu9u tDzLh2/ceThGK1khq8ijcCVq8E4qROo3STdPafptTK22BFJhD4ZVyOQEmiRuv9Z6N1oP fBD8X0/ApVVURTsYx9NaSL/RXLLTglyFV+Sk4Cx1Cjk6mXOxe92Xf05+HuaKgAlwvzmy +kWg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id k9-v6si1025528wmc.104.2018.07.30.23.06.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:06:24 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E01BE6000B; Tue, 31 Jul 2018 06:06:14 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 03/11] hugetlb: Introduce generic version of set_huge_pte_at Date: Tue, 31 Jul 2018 06:01:47 +0000 Message-Id: <20180731060155.16915-4-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, ia64, mips, powerpc, sh, x86 architectures use the same version of set_huge_pte_at, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 6 ------ arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 6 ------ arch/mips/include/asm/hugetlb.h | 6 ------ arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 6 ------ arch/sh/include/asm/hugetlb.h | 6 ------ arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 6 ------ include/asm-generic/hugetlb.h | 8 +++++++- 10 files changed, 10 insertions(+), 37 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index d4014fbe5ea3..398fb06e8207 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -37,12 +37,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return retval; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 4af1a800a900..874661a1dff1 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -60,6 +60,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, struct page *page, int writable); #define arch_make_huge_pte arch_make_huge_pte +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index afe9fa4d969b..a235d6f60fb3 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -20,12 +20,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 53764050243e..8ea439041d5d 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -36,12 +36,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 28c23b68d38d..77c8adbac7c3 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -4,6 +4,7 @@ #include +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index a7d5c739df9b..0794b53439d4 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -132,12 +132,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index f6a51b609409..bc552e37c1c9 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -25,12 +25,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 59d89b52ccb7..16b0c53ea6c9 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -12,6 +12,7 @@ struct pud_huge_patch_entry { extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; #endif +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 398da3b3414c..8db9a761964d 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,12 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index c697ca9dda18..ee010b756246 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -47,8 +47,14 @@ static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, { free_pgd_range(tlb, addr, end, floor, ceiling); } +#endif - +#ifndef __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT +static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte) +{ + set_pte_at(mm, addr, ptep, pte); +} #endif #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46E5214E0 for ; Tue, 31 Jul 2018 06:07:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33CEA29E79 for ; Tue, 31 Jul 2018 06:07:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2619C2A40A; Tue, 31 Jul 2018 06:07:37 +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 767E729E79 for ; Tue, 31 Jul 2018 06:07:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4E9D6B0010; Tue, 31 Jul 2018 02:07:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A00DF6B0266; Tue, 31 Jul 2018 02:07:35 -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 8C6816B0269; Tue, 31 Jul 2018 02:07:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 2CA396B0010 for ; Tue, 31 Jul 2018 02:07:35 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id z16-v6so11041136wrs.22 for ; Mon, 30 Jul 2018 23:07:35 -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=ftJLmMXqG8CmVZdOaOowhe8RqP5KCxqnspoUayMMrlA=; b=gwJjZLTOyAEJapCu4BYRzgMRN5xVmTjkUmW5T4gHlHbPKAk1SoeC4/E0Jp98FWoZ2d n7a11dZ6SzSJbrI1DCA9BJuyibpUVCk7++XswHeUqGrQtoDcuRqmfULY3iyijxPyhbg3 9wRyglTZXIxxg6q/IJ6d7vrbl5F5zWVHCBL9T9q1L0Wx9WzjArCpdzyxKYfyiDP970I7 AYIX99fWjjI/e78hTO49cwcui/3UrMULfUFM9TnTSW3vuEep6+Hb1nxk+kQTlUqyXGoQ N2TNcYX1LWjCoF5+/RBRk6TFF0CxhxyIXT949QxR1TsrstvrvMHy31eFXUmp1PNjr1vE d0rw== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEt7RLee1XJ7BLjdl9nKWZbxklV61f19iEm7EE5hPsnbJMSwggW hBuRiH+SD0bYYwn/cig2XXtpmaFzVZnJPKBpRy5TL7iDOqFSV05l0aCEVtt6RWQMNSRU18J90IV 83lNpmM0pbe/e90QhNkMz2LWoXpXCQayKKQuAdfDD9sor/PAobDIfT70Sf1Ic558= X-Received: by 2002:a5d:61ca:: with SMTP id q10-v6mr19817418wrv.33.1533017254752; Mon, 30 Jul 2018 23:07:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd4sat5KHQCugTI7KC0TalBuy7T0XdNezz5V8WMPncxwIVvOdAArLv5L+LRWtMHH7sml/5F X-Received: by 2002:a5d:61ca:: with SMTP id q10-v6mr19817379wrv.33.1533017253909; Mon, 30 Jul 2018 23:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017253; cv=none; d=google.com; s=arc-20160816; b=j2M0zhlp2AbAmPbpyBHzyXRMxJmvHLTRsXo6Ts+akDf+rbU+PdoFvSmX9heoUY20F5 9iAs62Cyc+4CoBTf3Q332dJLe4XOqqN425Vz3CXaDtRojzDd94ItPqX4CdCDD+ItG8dZ OuyKEOPklTdq9OpfrW/40QRU0M+pN2CeTd9VPYh+OHy56OpN2UwFbQCGo/Sx4gvLb1t7 2DiJbTSEw1/7CxN1gm1BzhxumPmewQQkAuF6mj7i5HGhyGPrlwBBgolbBQwavZpHz7KK SgCafPwyEJ0xvgitHEIg6Zr5EuRxpeEK/X1Mq8djoWOUftaY4/Dmg+DnllM4lzgEp3ri c1wg== 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=ftJLmMXqG8CmVZdOaOowhe8RqP5KCxqnspoUayMMrlA=; b=iKd+hCH0KAL60DbWdbzl79n3z5l9R0MUDGDP0sa7SotKfOIAz6FlYIE8y45MGRIyQL jbsUwoKvliw7usgWelik/PohrugVyc10gu6/PxC8oczJ76SO4iyiJdxfr5rLOJQOPfAm nWZEZMsgpDLyiiNyqWJ0QdhV2Z8f1owCOTXstTL2a4Upbh2a+S0pyrHDPzQwQwepxT75 0clh+QwCRd01kerimjr6DnxajBXaWbN3mFvgN0S8J/anTp3y9XjVjvMw/ICK1e05mMlz j3WxBrtCXCDtTEkQtaC86HGPf2AYHJnB8lCI3id62t2CbHQp5PfTt/Degxmja+fy7ucF FgyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net. [217.70.183.197]) by mx.google.com with ESMTPS id f42-v6si2045149wrf.336.2018.07.30.23.07.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:07:33 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.197; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id CBE531C000E; Tue, 31 Jul 2018 06:07:24 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 04/11] hugetlb: Introduce generic version of huge_ptep_get_and_clear Date: Tue, 31 Jul 2018 06:01:48 +0000 Message-Id: <20180731060155.16915-5-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000007, 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 arm, ia64, sh, x86 architectures use the same version of huge_ptep_get_and_clear, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 6 ------ arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 6 ------ arch/mips/include/asm/hugetlb.h | 1 + arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 1 + arch/sh/include/asm/hugetlb.h | 6 ------ arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 6 ------ include/asm-generic/hugetlb.h | 8 ++++++++ 10 files changed, 13 insertions(+), 24 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index 398fb06e8207..ad36e84b819a 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -49,12 +49,6 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, ptep_set_wrprotect(mm, addr, ptep); } -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 874661a1dff1..6ae0bcafe162 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -66,6 +66,7 @@ extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); extern void huge_ptep_set_wrprotect(struct mm_struct *mm, diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index a235d6f60fb3..6719c74da0de 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -20,12 +20,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); } -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 8ea439041d5d..0959cc5a41fa 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -36,6 +36,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 77c8adbac7c3..6e281e1bb336 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -8,6 +8,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 0794b53439d4..970101cf9c82 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -132,6 +132,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index bc552e37c1c9..08ee6c00b5e9 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -25,12 +25,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 16b0c53ea6c9..944e3a4bfaff 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -16,6 +16,7 @@ extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 8db9a761964d..e9e7fef867ad 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,12 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index ee010b756246..0f6f151780dd 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -57,4 +57,12 @@ static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR +static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, + unsigned long addr, pte_t *ptep) +{ + return ptep_get_and_clear(mm, addr, ptep); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DA2A1708 for ; Tue, 31 Jul 2018 06:08:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C56C2A5A7 for ; Tue, 31 Jul 2018 06:08:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F5192A69C; Tue, 31 Jul 2018 06:08:43 +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 9D7CE2A67E for ; Tue, 31 Jul 2018 06:08:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89FA76B0269; Tue, 31 Jul 2018 02:08:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8769B6B026A; Tue, 31 Jul 2018 02:08:41 -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 73DCF6B026B; Tue, 31 Jul 2018 02:08:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 14F256B0269 for ; Tue, 31 Jul 2018 02:08:41 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id s14-v6so11413609wra.0 for ; Mon, 30 Jul 2018 23:08:41 -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=iZY4oxzwBC2L31WkeJHHDywLZat5VkRDVcRYuINTcSA=; b=SF5LIrlvz6BDXFTysjvz/OM31zZnj82DCNLC6Mcb97OiTHxR0UR6Jo7npMRxOKIrpD j0Y3ITIX3hf5DtLXp5RnEfbTPaQr5ZxEH5EazcBO0CTCkL2ZhHqG5NUwytdLhrrH2ayZ 7q4wV8o+txgwQBZOEQtPY+aLPS6dbr6qKfVhnrTHeGQmHIJNdVxu1f/JkU2CI1E0BKiv 5xFJiTD2V8hgpfNUc2xdHGBaCGK8/rdSLB9nU412YaBNw0dOSQtVIMYzn2UfkwD8IiZu 3yhZJlxHY5Th0c19VGTowO2cYHbHlfB3b81u1Sd9fNwQdguGYGujxtwcavBpHrP7EhB2 7LJw== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEoiy3/WWwhJkapqeUZ7MUpNA7zR/WQ4jbR1uQdVu9agjzktZlu Uvewe3JNaSKfTGtW7+AzRjT7OuYHnzrJtKzv70dlMEiTPWHlHmkJ1YkW0efBh8hhUQa5Vgy8FUw ZmvvUMU5zyompj/lngc/3davjA1WinL3c0bznVkkDF3i7HzAvBNmE4Jsn/n3N9n4= X-Received: by 2002:a1c:9616:: with SMTP id y22-v6mr1337407wmd.72.1533017320579; Mon, 30 Jul 2018 23:08:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfwoDFue3jqA3AWcHMWERCn/XmPzu0KfxfvVs2rEkjTTEIAjjDmBdsVwJ4o07znlfQ2uvAc X-Received: by 2002:a1c:9616:: with SMTP id y22-v6mr1337350wmd.72.1533017319229; Mon, 30 Jul 2018 23:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017319; cv=none; d=google.com; s=arc-20160816; b=a5H88BehuWszitMNkvA/XzcgpJVAvqmjBUXvfDobD+WXY7AdfWMr8kvd6mxJTLLi38 rDVGpksMi+8gi3x/+xJLNFZyBO5SM5LZaYO0f3+M6qkGnxvIK6PGQKPNnsY4uAW/6KyJ wap457GMUJgbA1JotuPE4NgUeZAJYSnY6xiOreDS2Xlhw4cXb7kCtXTPGlQIGh/APETp HOYy1nJiCj8dtjcSJKA7l0WG50yKDNDLbGaHJdxlqDJzM7xTnnaYm1zMyA1/Y44garqp CCBG6z4sKnambirU3pJKfj91pt4cOVBW51qCzRlkh0diNyJBxIvt4kbIuywLcRQO7W9u DKqA== 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=iZY4oxzwBC2L31WkeJHHDywLZat5VkRDVcRYuINTcSA=; b=XSBdUFZBbdvTcAuSmFAM9e54Ws7hZFIZyHj5Bx7juCtcHRJ2B7dIBxqEKLemjajDWa 8p8C7ycwL1QgOGlqu4X2eIyFpa32Ein03BKqMDZTHwb4fvUarrJP404aiYelnj3gYfk1 7E8vAi0krJLtQvWXl9fxhIb5rlJqDGnM2UADWpXILbAb1SmXVTaEKHqOIn/Ut0NhxSjw MPXMh0Q1Hm1CuE7qfG5k7TIVbCxxtapUSyD4pGmFZTLBNJvWSMSUl1Wcm9HzRMadBQQc tVvQga5k/4gaTctSx4X/oxC6V9iU/FHikIjkPt3kl06tWzxD1rib/1V1tgipDKZ1tfdZ IydQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net. [217.70.183.197]) by mx.google.com with ESMTPS id h4-v6si999670wmh.91.2018.07.30.23.08.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:08:39 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.197; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 27FAA1C0003; Tue, 31 Jul 2018 06:08:33 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 05/11] hugetlb: Introduce generic version of huge_ptep_clear_flush Date: Tue, 31 Jul 2018 06:01:49 +0000 Message-Id: <20180731060155.16915-6-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, x86 architectures use the same version of huge_ptep_clear_flush, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 6 ------ arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 1 + arch/mips/include/asm/hugetlb.h | 1 + arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 1 + arch/sh/include/asm/hugetlb.h | 1 + arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 6 ------ include/asm-generic/hugetlb.h | 8 ++++++++ 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index ad36e84b819a..b897541520ef 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -37,12 +37,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return retval; } -static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep) -{ - ptep_clear_flush(vma, addr, ptep); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 6ae0bcafe162..4c8dd488554d 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -71,6 +71,7 @@ extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); extern void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH extern void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep); #define __HAVE_ARCH_HUGE_PTE_CLEAR diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 6719c74da0de..41b5f6adeee4 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -20,6 +20,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 0959cc5a41fa..7df1f116a3cc 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -48,6 +48,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, return pte; } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 6e281e1bb336..9afff26747a1 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -32,6 +32,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 970101cf9c82..0b02856aa85b 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -143,6 +143,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, #endif } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 08ee6c00b5e9..9abf9c86b769 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -25,6 +25,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 944e3a4bfaff..651a9593fcee 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -42,6 +42,7 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index e9e7fef867ad..fd59673e7a0a 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,12 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep) -{ - ptep_clear_flush(vma, addr, ptep); -} - static inline int huge_pte_none(pte_t pte) { return pte_none(pte); diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 0f6f151780dd..ffa63fd8388d 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -65,4 +65,12 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH +static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep) +{ + ptep_clear_flush(vma, addr, ptep); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06CBA14E0 for ; Tue, 31 Jul 2018 06:09:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E83CC2A67E for ; Tue, 31 Jul 2018 06:09:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB4572A6B6; Tue, 31 Jul 2018 06:09:53 +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 2B81D2A67E for ; Tue, 31 Jul 2018 06:09:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 543B86B026B; Tue, 31 Jul 2018 02:09:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 51A586B026C; Tue, 31 Jul 2018 02:09:52 -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 431A96B026D; Tue, 31 Jul 2018 02:09:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id D9BDC6B026B for ; Tue, 31 Jul 2018 02:09:51 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id z23-v6so960945wma.2 for ; Mon, 30 Jul 2018 23:09:51 -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=nQ8HnQA9nsyaLmLJfpkMRXvo+ifti8LgzlqKpr4OvWs=; b=ElyF114moF63zXhVaH6kTmT0nVwIkP83DtnuvtbMqrgeuE/cfigUazt+4gacmo7MSF SIRw6gs9zKFo5YjzN2ZouGzdbX/sWbN2h2HpX838XzizAkArzueVh/xRWKAEI8jAGeWp qgNeRbK6cr/h/db2Q3FeUEWnhxp4+RAdv3YqRy1Q+27vhqrS0yqiNNxeVTRI/1qKLf46 lVdP+fHTze3j+waaOj7n0qLhs0fqgHwmMW6ipXVzWSYk85NTNTFis/50I7EyDQe+g/ZT uM6tkO8k0ouGnmfCAX/UYyYhNORlNCp8ykWrJ2YBRL8bTPUgMCY0TagChajJDo6fptt0 X0sQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlFy3Mu7/pZE8SaLtdxrJkXqDf7bLYgzKpLO/v3mxR+/JpOkSPvD Dw6u6MmredZc8MtM2YRid85EbYIj/p5mW1xle1LLY3B392c02h/IAohwzTLI9Q153gTtSOvlgUh cEkcKf7nldh8Ja0ilq6b263aRyo2S2xx8LyTIHHa+DiiwA36ZE7JSoRPmjG1KoKw= X-Received: by 2002:a1c:c64f:: with SMTP id w76-v6mr1343424wmf.3.1533017391408; Mon, 30 Jul 2018 23:09:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfGwnmHpvAvHbWsIVu3jkkJoAURmsqETCwOvOKf8Pa4q2e3ZAnAoOV2B5p8Lti4WIRPmMR3 X-Received: by 2002:a1c:c64f:: with SMTP id w76-v6mr1343380wmf.3.1533017390133; Mon, 30 Jul 2018 23:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017390; cv=none; d=google.com; s=arc-20160816; b=x3cictZKR4nh7r05CClIVwHV2REGqMBbeNCY7WqWWuTAmlAsyjuQRQd8OZvv4CVrQe QF4QGBcePAfKyPnPk3T4/IJm+R3jn9SDxA+3sAdH3D2MIokLp4tZwqo/y+SgBto3dLiS SiPkO2mgBj9U6be8fJCJTpm04iigc4CJCvi+v+LHG9lWHfxy5XTTPWknLBkzfuMOzJ55 exrZMyMeRgYU0VdXcd2N9T1RTS6SKLAX5lSMeM55T5lI7EJ910c7s12r8vNm9yQyG0c8 V4yynjtur4+U8vDzbrFgMuEhWcQiuOL2yDnqci0KEbMmAGwTP4JF1PDKf9JhaFuSAynK sSng== 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=nQ8HnQA9nsyaLmLJfpkMRXvo+ifti8LgzlqKpr4OvWs=; b=bdGz84ujNP3rhbLz0CWV7ZSgM2WxBcM06uhsKi/E812EN/J9Fy8JULcvF2P7jA6zUc ZZ28UO5V0dAVsQPPBhB1KYTcBhQuO1UE66gB5ufEZ5FY8Ui6DEWR3GN7s2+CNE6zFOBD s1GdQFMv53GRaPhIyo6JKJ6gPYuiGRyEnDu/xriGmye5eEQcEtuMo+Q3B4eDo9OzSatE E5MOb+Ullt5BFJTQO6uTwWQ2JCzmnVdlv1mGtuzgDkpNbO/T6l1SuvdVFufrtPrJfvW2 6o/sTx36jg5oRel+9UzPyiMv2nXiIq+Cz04UKx+hfTx4872qxczCEYxH6HyK6EvI8O0g V91Q== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net. [217.70.183.198]) by mx.google.com with ESMTPS id g18-v6si14018290wrs.292.2018.07.30.23.09.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:09:50 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.198; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 83653C0004; Tue, 31 Jul 2018 06:09:39 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 06/11] hugetlb: Introduce generic version of huge_pte_none Date: Tue, 31 Jul 2018 06:01:50 +0000 Message-Id: <20180731060155.16915-7-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, arm64, ia64, parisc, powerpc, sh, sparc, x86 architectures use the same version of huge_pte_none, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb.h | 5 ----- arch/arm64/include/asm/hugetlb.h | 5 ----- arch/ia64/include/asm/hugetlb.h | 5 ----- arch/mips/include/asm/hugetlb.h | 1 + arch/parisc/include/asm/hugetlb.h | 5 ----- arch/powerpc/include/asm/hugetlb.h | 5 ----- arch/sh/include/asm/hugetlb.h | 5 ----- arch/sparc/include/asm/hugetlb.h | 5 ----- arch/x86/include/asm/hugetlb.h | 5 ----- include/asm-generic/hugetlb.h | 7 +++++++ 10 files changed, 8 insertions(+), 40 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index 537660891f9f..c821b550d6a4 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -44,11 +44,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 4c8dd488554d..49247c6f94db 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -42,11 +42,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 41b5f6adeee4..bf573500b3c4 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -26,11 +26,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 7df1f116a3cc..1c9c4531376c 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -55,6 +55,7 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, flush_tlb_page(vma, addr & huge_page_mask(hstate_vma(vma))); } +#define __HAVE_ARCH_HUGE_PTE_NONE static inline int huge_pte_none(pte_t pte) { unsigned long val = pte_val(pte) & ~_PAGE_GLOBAL; diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 9afff26747a1..c09d8c74553c 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -38,11 +38,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 0b02856aa85b..3562d46585ba 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -152,11 +152,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, flush_hugetlb_page(vma, addr); } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 9abf9c86b769..a9f8266f33cf 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -31,11 +31,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 651a9593fcee..11115bbd712e 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -48,11 +48,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index fd59673e7a0a..42d872054791 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,11 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - static inline pte_t huge_pte_wrprotect(pte_t pte) { return pte_wrprotect(pte); diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index ffa63fd8388d..2fc3d68424e9 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -73,4 +73,11 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, } #endif +#ifndef __HAVE_ARCH_HUGE_PTE_NONE +static inline int huge_pte_none(pte_t pte) +{ + return pte_none(pte); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23AD81708 for ; Tue, 31 Jul 2018 06:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 124A02A67E for ; Tue, 31 Jul 2018 06:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05A5B2A6B6; Tue, 31 Jul 2018 06:11:01 +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 5EBBE2A67E for ; Tue, 31 Jul 2018 06:11:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7664C6B026D; Tue, 31 Jul 2018 02:10:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 73AEA6B026E; Tue, 31 Jul 2018 02:10:59 -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 62AFE6B026F; Tue, 31 Jul 2018 02:10:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 06BE06B026D for ; Tue, 31 Jul 2018 02:10:59 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id q26-v6so6625554wmc.0 for ; Mon, 30 Jul 2018 23:10:58 -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=aw2bayCCtDcCN61y8SII84YAB0i8LbEefgocZw4URbc=; b=JeP4m6Cv1Gfu90adhvqzju6a7oqom6NinLCLYLl5oruok9oWow4kYFjIUpF09CPQ9V Iz7dqOROZS1qnV3bNL28FIckTTHG07mgVm1FE3FeEW/0UKY22HkuKWBhdHhD7UOuU2KI 7oEw/Mh/740XwBwMz4BCpxmVR+ty3MUeqyVO4o59sgLfL2+c5pQ3mcusN0vQt7aOoeFb qoBQ0HQmK3YU9f+sn/27PxLlA2e86pDSU4bDdcEYYVY+iqipCjh8Q0ORrlrUgnk0opn8 0898BZEUbsI4yjCtWkwQOsfKFoYm2P5Fp8qI8Z14a9NcB6g1iIURKZKTIq08ZXx1Tdd3 ifhg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlEhAqV+NRepiA1XT5gq/969LK5eydOu/FOxEUtOWW9BBqWuwySg KzwbvDoE3iiqpLwIAJp1P9UbBpYhjtNt3+Gfts8D7l/xXrF4OFzewYDGPyGL1+s7J7GQ6AP730N 3Xxe5mhhgIyw3em+vFo1oUJw/QkEhpX7lzjeBIJPahkJniKDTue3H8YX7d0uk4Ws= X-Received: by 2002:a1c:68f:: with SMTP id 137-v6mr1352971wmg.82.1533017458524; Mon, 30 Jul 2018 23:10:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeQgz0vDO9ZM1b6t4Fr6z1nY6IcrI+QZIDB5iFYplOrkQYA7MLvpS6eExDTYvUk38KcpoRN X-Received: by 2002:a1c:68f:: with SMTP id 137-v6mr1352928wmg.82.1533017457176; Mon, 30 Jul 2018 23:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017457; cv=none; d=google.com; s=arc-20160816; b=r9ykoHJJ8hKQd1+dANUltJVqQN+UFrXnGygD+EJl2C6jTJZ6zBD5KEwHVVp3d/ZsPO 0VxsNW4cTLmgpEY/ZLvg+3WJCN8fq49EwrLtB9E1R+wLSQar5ti2vle5zqNrMZyq1M6D 8jha0ErsvCfF6Se43TpZzGwnVarwLrJ/W8OVjzoEEhzGjydke6qI/s6HAjZCegCC4VCi MUZHtGTCaovXdgwZ5UXpY+5TeNOI2jlB/OUdQFAhInYXYtH7z4Q9UClv/MITShCr7Wf2 VnddaAnlZiu5l1JOP6mgudPTPHS2SnRDN8N5rww6CtYj69DN+IJF5iC+3b9m9DVs8o+5 cLXQ== 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=aw2bayCCtDcCN61y8SII84YAB0i8LbEefgocZw4URbc=; b=r7EdRIjB58qAVxnplTOg+cfWJMzpHjtg1wlSjzdtmckjM36R6fCH6N2IgUziYeCmZ1 jHn1SvfxJoM5/4//DmK1j7LEAkjP27Qhu0Igtgd7W7nk3nHCVrBrBUd2coV6Ry35BRNg qoDcf4EsvKg1KZBnU/R+hijbtkUGBVa5HsaBDiT1cdCZLzOMpB7yWNNmVeIrRbxV9KV+ uJBbiV3gfSiZMVyRFzDg5hMmlOq/y6euvMlM1jNoSLMwO0UqxTwG3Qz5pH0hw8PqHAxy vpdZ0BLI1VKhNm/vKW5xmJ0GtzNIslvqplj8CGVWFlF+40dOH7T6mdYWdKif5k517X5o 6fQg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net. [217.70.183.193]) by mx.google.com with ESMTPS id g4-v6si1019758wmi.196.2018.07.30.23.10.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:10:57 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.193; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.193 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 60D52240003; Tue, 31 Jul 2018 06:10:50 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 07/11] hugetlb: Introduce generic version of huge_pte_wrprotect Date: Tue, 31 Jul 2018 06:01:51 +0000 Message-Id: <20180731060155.16915-8-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, arm64, ia64, mips, parisc, powerpc, sh, sparc, x86 architectures use the same version of huge_pte_wrprotect, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb.h | 5 ----- arch/arm64/include/asm/hugetlb.h | 5 ----- arch/ia64/include/asm/hugetlb.h | 5 ----- arch/mips/include/asm/hugetlb.h | 5 ----- arch/parisc/include/asm/hugetlb.h | 5 ----- arch/powerpc/include/asm/hugetlb.h | 5 ----- arch/sh/include/asm/hugetlb.h | 5 ----- arch/sparc/include/asm/hugetlb.h | 5 ----- arch/x86/include/asm/hugetlb.h | 5 ----- include/asm-generic/hugetlb.h | 7 +++++++ 10 files changed, 7 insertions(+), 45 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index c821b550d6a4..9ca14227eeb7 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -44,11 +44,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void arch_clear_hugepage_flags(struct page *page) { clear_bit(PG_dcache_clean, &page->flags); diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 49247c6f94db..1fd64ebf0cd7 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -42,11 +42,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void arch_clear_hugepage_flags(struct page *page) { clear_bit(PG_dcache_clean, &page->flags); diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index bf573500b3c4..82fe3d7a38d9 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -26,11 +26,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 1c9c4531376c..b3d6bb53ee6e 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -62,11 +62,6 @@ static inline int huge_pte_none(pte_t pte) return !val || (val == (unsigned long)invalid_pte_table); } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index c09d8c74553c..5a102d7251e4 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -38,11 +38,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 3562d46585ba..7123599089c6 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -152,11 +152,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, flush_hugetlb_page(vma, addr); } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index a9f8266f33cf..54f65094efe6 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -31,11 +31,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 11115bbd712e..f661362376e0 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -48,11 +48,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 42d872054791..3cd3a2c9840e 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -28,11 +28,6 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 2fc3d68424e9..cd9697672b79 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -80,4 +80,11 @@ static inline int huge_pte_none(pte_t pte) } #endif +#ifndef __HAVE_ARCH_HUGE_PTE_WRPROTECT +static inline pte_t huge_pte_wrprotect(pte_t pte) +{ + return pte_wrprotect(pte); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41AB01708 for ; Tue, 31 Jul 2018 06:12:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C9CF2A67E for ; Tue, 31 Jul 2018 06:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DE492A6B6; Tue, 31 Jul 2018 06:12:07 +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 618142A67E for ; Tue, 31 Jul 2018 06:12:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8773E6B026F; Tue, 31 Jul 2018 02:12:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 84CE16B0270; Tue, 31 Jul 2018 02:12:05 -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 73CC86B0271; Tue, 31 Jul 2018 02:12:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 1AC1A6B026F for ; Tue, 31 Jul 2018 02:12:05 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id e3-v6so11119211wrr.8 for ; Mon, 30 Jul 2018 23:12:05 -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=I08mwKbQLh3reMZAL4keG22jVLt1HSI81QiaXZJPzXU=; b=SqaR4GCWFB1pciN1rO+woBzS7dqJTvRmmoyxjzlf+URXu85O+tQcF7aQ7IRO5G1BXN pR9Oy8AzH2QlECmlUBPxvs+AkaqzjHcCeAjlcDWs9yoOaH/KMY0dLbiiVEAkaVXgHVuN S7XNwz0bMg1zk/N/nsD27QsKUCzSwOz6NWiUgBYyEQsoAQQZoSxW8H+h2lW/853o+ug+ hu8oy8flhX4GkDz4mwjH12uinfhKZA25gvDCgZ0yTismHm/EIGNuEyBsA907gGEN1Fml 4llwGWr+Ml26ReRR0p8ixTxrI9c+wOD3d2Zy28r1UMxfR/lwqcRTjOj6Xh4rI6kX04l/ ZExQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlHczRNNbTxgWe0VByBu/+feJrNRxNM8zNIjW2ZYuJPULbZOAxaW m2dWXfJqyN0MgNsaz4TV60uBolvrY0MDcWc2ZVG6yc9jK1o/kqVbNdcSpfjoZBcoHSTNfRxzJga 0NPXs8LQYG8uO2Cbz4OJfTjpo86eTfmIi756GSzHaUMoOr5eLAWv+xy6C6JTNSOw= X-Received: by 2002:a1c:6fdd:: with SMTP id c90-v6mr1271795wmi.16.1533017524594; Mon, 30 Jul 2018 23:12:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf3aat+UhbUD5zKb1cb2Rak1YwafacrG+URNUE5rr4/NWC8KuDzYtP1b3ToUJjWnaO8dZL/ X-Received: by 2002:a1c:6fdd:: with SMTP id c90-v6mr1271742wmi.16.1533017523171; Mon, 30 Jul 2018 23:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017523; cv=none; d=google.com; s=arc-20160816; b=Isfa0HFBOrJISafev7OK/znIku30cZ3EefxSOgjhKXXGdTki6H+uFzCCrKz6cMtCx6 Kts0zgKNqBGd7i7BQ93fsSacAIJgEBXU9Z/P7n7ejccl4nlYN5Res55utzBSci8rDB2F aw75aVe4h0mkdEcko2aot8kO6LYFR4xtfTGUfu6YAxF+Q9NeGruk63AaMBT0t5jZlVuE nPu26NTcy/hUwL4eB9b6P6DrSM17GfHBZMd/Kp78MTuIrAEEOXbGdkJdO+gowvO2VApb RtDaJBO5UkRtckOgEf/yzOeaiiflRsq4+slwNwkPZxqwzgBE3zZesml2fbRmevZyqAoL LyQw== 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=I08mwKbQLh3reMZAL4keG22jVLt1HSI81QiaXZJPzXU=; b=P1y2GwC2VaipzsU5icyyvv+Sl/I7Cw/joZ7fxEAWvC/2/8p7YKoqT6XcBIbf2szyHd o63FmIZJonHJAJvUYwVJigkmx8MTuanXNBAR0cC4Q/qm1790Lvb5qiD/j3o3CxY8NsaB EDi8PmjkbZk2S/9+7qeOt8/rvi57w1WWI7xBRHM00i0yG2/qTsXLbzVZv1OEWWamIf3G ruhi48M2eD+yKMhNQoUpcyUILouKl2xjdQi/ztJz/iHUNhnHg59AzlbnR/i3E+dg4EUl vKp9o9PhRakYUmZULP2mKoDH6jzxyRuF6xSYtEYs8xqAC6mUe01fPGpRWFyyBqiHw9pR dLsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net. [217.70.183.198]) by mx.google.com with ESMTPS id b6-v6si12681640wrw.461.2018.07.30.23.12.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:12:03 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.198; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.198 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 6EA71C0002; Tue, 31 Jul 2018 06:11:57 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 08/11] hugetlb: Introduce generic version of prepare_hugepage_range Date: Tue, 31 Jul 2018 06:01:52 +0000 Message-Id: <20180731060155.16915-9-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, arm64, powerpc, sparc, x86 architectures use the same version of prepare_hugepage_range, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb.h | 11 ----------- arch/arm64/include/asm/hugetlb.h | 11 ----------- arch/ia64/include/asm/hugetlb.h | 1 + arch/mips/include/asm/hugetlb.h | 1 + arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 15 --------------- arch/sh/include/asm/hugetlb.h | 1 + arch/sparc/include/asm/hugetlb.h | 16 ---------------- arch/x86/include/asm/hugetlb.h | 15 --------------- include/asm-generic/hugetlb.h | 15 +++++++++++++++ 10 files changed, 19 insertions(+), 68 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index 9ca14227eeb7..3fcef21ff2c2 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -33,17 +33,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -static inline int prepare_hugepage_range(struct file *file, - unsigned long addr, unsigned long len) -{ - struct hstate *h = hstate_file(file); - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - return 0; -} - static inline void arch_clear_hugepage_flags(struct page *page) { clear_bit(PG_dcache_clean, &page->flags); diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 1fd64ebf0cd7..3e7f6e69b28d 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -31,17 +31,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -static inline int prepare_hugepage_range(struct file *file, - unsigned long addr, unsigned long len) -{ - struct hstate *h = hstate_file(file); - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - return 0; -} - static inline void arch_clear_hugepage_flags(struct page *page) { clear_bit(PG_dcache_clean, &page->flags); diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 82fe3d7a38d9..cbe296271030 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -9,6 +9,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); +#define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE int prepare_hugepage_range(struct file *file, unsigned long addr, unsigned long len); diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index b3d6bb53ee6e..6ff2531cfb1d 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -18,6 +18,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } +#define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE static inline int prepare_hugepage_range(struct file *file, unsigned long addr, unsigned long len) diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 5a102d7251e4..fb7e0fd858a3 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -22,6 +22,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, * If the arch doesn't supply something else, assume that hugepage * size aligned regions are ok without further preparation. */ +#define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE static inline int prepare_hugepage_range(struct file *file, unsigned long addr, unsigned long len) { diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 7123599089c6..69c14ecac133 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -117,21 +117,6 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); -/* - * If the arch doesn't supply something else, assume that hugepage - * size aligned regions are ok without further preparation. - */ -static inline int prepare_hugepage_range(struct file *file, - unsigned long addr, unsigned long len) -{ - struct hstate *h = hstate_file(file); - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - return 0; -} - #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 54f65094efe6..f1bbd255ee43 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -15,6 +15,7 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, * If the arch doesn't supply something else, assume that hugepage * size aligned regions are ok without further preparation. */ +#define __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE static inline int prepare_hugepage_range(struct file *file, unsigned long addr, unsigned long len) { diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index f661362376e0..2101ea217f33 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -26,22 +26,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -/* - * If the arch doesn't supply something else, assume that hugepage - * size aligned regions are ok without further preparation. - */ -static inline int prepare_hugepage_range(struct file *file, - unsigned long addr, unsigned long len) -{ - struct hstate *h = hstate_file(file); - - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - return 0; -} - #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 3cd3a2c9840e..59c056adb3c9 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -13,21 +13,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -/* - * If the arch doesn't supply something else, assume that hugepage - * size aligned regions are ok without further preparation. - */ -static inline int prepare_hugepage_range(struct file *file, - unsigned long addr, unsigned long len) -{ - struct hstate *h = hstate_file(file); - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - return 0; -} - static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index cd9697672b79..6c0c8b0c71e0 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -87,4 +87,19 @@ static inline pte_t huge_pte_wrprotect(pte_t pte) } #endif +#ifndef __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE +static inline int prepare_hugepage_range(struct file *file, + unsigned long addr, unsigned long len) +{ + struct hstate *h = hstate_file(file); + + if (len & ~huge_page_mask(h)) + return -EINVAL; + if (addr & ~huge_page_mask(h)) + return -EINVAL; + + return 0; +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550075 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41E2C157D for ; Tue, 31 Jul 2018 06:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3992981B for ; Tue, 31 Jul 2018 06:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AE062A6B4; Tue, 31 Jul 2018 06:13:13 +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 4A6972981B for ; Tue, 31 Jul 2018 06:13:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 715986B0271; Tue, 31 Jul 2018 02:13:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6C4606B0272; Tue, 31 Jul 2018 02:13:11 -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 5DB616B0273; Tue, 31 Jul 2018 02:13:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 059A46B0271 for ; Tue, 31 Jul 2018 02:13:11 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id o25-v6so965089wmh.1 for ; Mon, 30 Jul 2018 23:13:10 -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=qf3ZQv902vFswx0SE5DvkAyQLLkVbS1n6n4CjotCOXk=; b=b3BToM3oi8ZcTHQcRKPrkjAy/DW1PWrJSixwbiapxtbdF6sLf27BB1cK+n+bIAIwQj SjqJHdeBk4mZrDJXRIPK4NAhJSsqjI74Cn9JUBdqhpao7b+3qkWHh7byUzUgpBsMtUX+ eVhqsGB3j4ur1K6J7SB2aKla2LqZr84CRbU95HwyR4wYdT7DTKSE1IDvvFYzZ/L6n58u +sNv2hGK2odqgbj4wHiJ0fiGqYlwNHqj7vxjU0MAbpcgEgxhJq1ZyDBO/aVc4fGtO3Hi Sx/Xg9po2GFdEvV49YYojx1sDN7zPvHeVGSEmN57tBCFbqB0kYdA3qrDxzL8DQZlfSya 8vMQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlF9C+qkqiKG2dUhz2KzVVx0qVuZg+cRFTLrQIDOnzl7foiDA19L 9xiz/rFedATbGSjTIFpXOMqbxZOqIy9TJcKYi28BrXUM8ajm6KfyaaOJx7Tlt2GBnOKuAafFXWQ egY3LHz11W0gxIYtmRzJzy71ao1d88wqJZGWpHWExouFpzw+nYRlGXfmJjXJR9gE= X-Received: by 2002:a1c:96c8:: with SMTP id y191-v6mr1246304wmd.37.1533017590465; Mon, 30 Jul 2018 23:13:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcpWnxOyfVFGSXhhCcyz01nHZshBZmdRB0WClaJ7zc9r+gXxSBOIYckRM8+XcAXAqsTKAZo X-Received: by 2002:a1c:96c8:: with SMTP id y191-v6mr1246263wmd.37.1533017589010; Mon, 30 Jul 2018 23:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017588; cv=none; d=google.com; s=arc-20160816; b=F8HBxVvcTIzC6J4URxDKP5bL+Z0L5eGBqmwXgLz5hUqZs1mK61/WR/LAj701wxbI2S IANbKOAsb+3tgqwJ8B0yD1tmxirtMRTsB+m8rhxTpQZ2cTVYonpgKsHjAhlQS72ZEYUU 26qPFdDkNir8bmiEhMMNHBJypJinP+KNhJMYixBU/sgx/y82JspvfSD0XFcVsJUOtT5p WqBMAAGV69OAJnzULoY8YKbq2xYspR2Q7r4KOuynrGa9wq1VvuzRXTe2A5AyuwnZ3wx/ gNVH2a+EIRyfXWbqqJ7v6JovxMiDWYzNVs8gtvZe6zGidrzypkCmuBLm1eOSuyMFjZlR 2JCw== 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=qf3ZQv902vFswx0SE5DvkAyQLLkVbS1n6n4CjotCOXk=; b=dRTgZ8XhB9ZLQ4dDp6U11WXHmcshvbpeFtpef0si88HPRktdaggPdxSX5wdcs0DzkM TnLyZlI0Hr4ub+GBkY/h0xK8avtoS4JycGyX0JdKf+tgj/8+ICpn+UrYsoPucc76OVUv q77TRkAc9vY5zZyYDLO8cvcN8lzeFfzd5LQR+Yxlmx31gQeqfM/E8jsMmbEZFwZkZejl Yser86szAzXg3rnlC+ahyyDUI+4417CWu/EUrlZAESt4mXuWenasJzhmnQkSXD+sFURR xp9KlL6EngZd+BH0EhJ11s4ThF7RzRGzvBulXJCS8oxidgTJIdBeL7yVUyM6nZpPg42N LyKA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net. [217.70.183.195]) by mx.google.com with ESMTPS id w68-v6si989008wmw.169.2018.07.30.23.13.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:13:08 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.195; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.195 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 60F2060002; Tue, 31 Jul 2018 06:13:03 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 09/11] hugetlb: Introduce generic version of huge_ptep_set_wrprotect Date: Tue, 31 Jul 2018 06:01:53 +0000 Message-Id: <20180731060155.16915-10-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, ia64, mips, sh, x86 architectures use the same version of huge_ptep_set_wrprotect, so move this generic implementation into asm-generic/hugetlb.h. Note: powerpc uses twice for book3s/32 and nohash/32 the same version as the above architectures, but the modification was not straightforward and hence has not been done. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 6 ------ arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 6 ------ arch/mips/include/asm/hugetlb.h | 6 ------ arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 2 ++ arch/powerpc/include/asm/book3s/64/pgtable.h | 1 + arch/powerpc/include/asm/nohash/32/pgtable.h | 2 ++ arch/powerpc/include/asm/nohash/64/pgtable.h | 1 + arch/sh/include/asm/hugetlb.h | 6 ------ arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 6 ------ include/asm-generic/hugetlb.h | 8 ++++++++ 13 files changed, 17 insertions(+), 30 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index b897541520ef..8247cd6a2ac6 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -37,12 +37,6 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return retval; } -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 3e7f6e69b28d..f4f69ae5466e 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -48,6 +48,7 @@ extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT extern void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); #define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index cbe296271030..49d1f7949f3a 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -27,12 +27,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 6ff2531cfb1d..3dcf5debf8c4 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -63,12 +63,6 @@ static inline int huge_pte_none(pte_t pte) return !val || (val == (unsigned long)invalid_pte_table); } -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index fb7e0fd858a3..9c3950ca2974 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -39,6 +39,7 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 02f5acd7ccc4..d2cd1d0226e9 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -228,6 +228,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, { pte_update(ptep, (_PAGE_RW | _PAGE_HWWRITE), _PAGE_RO); } + +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 42aafba7a308..7d957f7c47cd 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -451,6 +451,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 0); } +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 7c46a98cc7f4..f39e200d9591 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -249,6 +249,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, { pte_update(ptep, (_PAGE_RW | _PAGE_HWWRITE), _PAGE_RO); } + +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h index dd0c7236208f..69fbf7e9b4db 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -238,6 +238,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_update(mm, addr, ptep, _PAGE_RW, 0, 0); } +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index f1bbd255ee43..8df4004977b9 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -32,12 +32,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 2101ea217f33..c41754a113f3 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -32,6 +32,7 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 59c056adb3c9..a3f781f7a264 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -13,12 +13,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 6c0c8b0c71e0..9b9039845278 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -102,4 +102,12 @@ static inline int prepare_hugepage_range(struct file *file, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT +static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, + unsigned long addr, pte_t *ptep) +{ + ptep_set_wrprotect(mm, addr, ptep); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7A8E157D for ; Tue, 31 Jul 2018 06:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68462A6B4 for ; Tue, 31 Jul 2018 06:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AAD72A6BE; Tue, 31 Jul 2018 06:14:22 +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 EC99B2A6B4 for ; Tue, 31 Jul 2018 06:14:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCD6B6B0273; Tue, 31 Jul 2018 02:14:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D7B296B0274; Tue, 31 Jul 2018 02:14:20 -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 C44716B0275; Tue, 31 Jul 2018 02:14:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 649AB6B0273 for ; Tue, 31 Jul 2018 02:14:20 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id f13-v6so11362662wru.5 for ; Mon, 30 Jul 2018 23:14:20 -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=r8MxGpOX6C0o5GFa7T8h6n+xNI8HET32vC76IF12SaY=; b=D24/1QhbEyUrPFuTAfMZKn5ypj9KEKvvLi9cwy3qLKCoPD/GBv/wF2VaSKCAvUEHBp VQIxWV+BbxkaXONUQNbUDLOTeWIB63QIjpnL15Bk3E3Mnl8k/MRp4tEBdXNnW8RTs+he mGhXvuSxifBsB0rALVMXM51zyrklF9mWy59ZzDoQbgcmYjODo2+UQhGwCmQ182Zb2P/g n8DNXQ0SuH/vi1XQ9gemwWnM06/TtazQ4qgY/0CMC70/qAYv+AQ3+4B/6DslxIPjxsYm khUFzCz59frjH6WjshnZUkD2+3WKhtT9JEO4VhCzhSJJx8vU83u8LlahxF/Pwc7SopRN vyNQ== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.201 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlFApC3ORY5MpztCYsbdJ38TMY515EEBVC5uI7oJr43//7m2OlZf E0UjH3WhvEncfTf9XKLdXb+R6jrJjtlcaNXOq2I/jA8gYcOyZzaMWZV/X5nlV2bTjszhq+o1GB5 C+2NLHITYoH0h5pSsHbtHeijztDUkLBBSxvFayTmEppuW/QWGa/vVmGY8/myB9Ic= X-Received: by 2002:a5d:55c8:: with SMTP id i8-v6mr19642293wrw.38.1533017659960; Mon, 30 Jul 2018 23:14:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+AXzxZ6xJ3+rJUZwYUleE90CZNVRc+rNQXbIQ9igaG/Y4wTc35XvmyNO7H8Ix51ry7BAJ X-Received: by 2002:a5d:55c8:: with SMTP id i8-v6mr19642260wrw.38.1533017659144; Mon, 30 Jul 2018 23:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017659; cv=none; d=google.com; s=arc-20160816; b=hwWfblfMWDV7WBJGkNUzg6Mv6zMAPUUkL6P8Fc3NsVrUF4MgVmbq5prJBHe3WkYbao cI6iaDQtbKlr2OfPM4YQnk8qa0pWIn18TNnQZuS3P3NhYPJVceSZBzoIuz98J37HrZ8+ 57KeOcoYVo5ZQrWlG/qMI5Atua8flRWv2M5Ju8ni/SX0VwT0wH3EGa0+AUVxA2ujuQF1 xwyLGa7Kd5CaMEcjZO2Ss7MxX54l2FIwUQzoix+wmXQdXcRUzGsVnEyD5qCkmri8BuzD YC4nK6lr/J1JHnIMiThvdHJbf8rzWc5sNAzZYPhIq6ISGpjuyp+XSFs0qosmP1PrKvFs 1+PQ== 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=r8MxGpOX6C0o5GFa7T8h6n+xNI8HET32vC76IF12SaY=; b=JsoclRwNEzB2G8eba+SbSGXIySMmGyaXfdXtRowpjcxXsl8CyBGP6Chf4hSade3zPM VH+Q4qoA5aLFxkp1mytE55BO64ZdmFM/NcJ/EKY72sNpM/2IQD694dj0qzNDPeMdbYX2 2iCRGrOfbhPNZRpFMA2YOrfgUHY0T1H5B16ulCcirgidXkUN8+V5C9KwSFlA+nyPQAVC 6Kt08kzIrjOQ9gt4Aw/GyeO338ALDesHTNk1hhKz+BkOAFC1OoM0Hvi6txB0RcwCFxv4 LWr5sIZ6KMmOiHk95vpEDGBuc3tToRfTryjdmr6odVstZgN5n0Krq/WFgY6GNmtF8nJu ycKw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.201 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net. [217.70.183.201]) by mx.google.com with ESMTPS id f4-v6si2999152wrg.265.2018.07.30.23.14.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:14:19 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.201 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.201; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.201 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 4FF511BF203; Tue, 31 Jul 2018 06:14:09 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 10/11] hugetlb: Introduce generic version of huge_ptep_set_access_flags Date: Tue, 31 Jul 2018 06:01:54 +0000 Message-Id: <20180731060155.16915-11-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 arm, ia64, sh, x86 architectures use the same version of huge_ptep_set_access_flags, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 7 ------- arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 7 ------- arch/mips/include/asm/hugetlb.h | 1 + arch/parisc/include/asm/hugetlb.h | 1 + arch/powerpc/include/asm/hugetlb.h | 1 + arch/sh/include/asm/hugetlb.h | 7 ------- arch/sparc/include/asm/hugetlb.h | 1 + arch/x86/include/asm/hugetlb.h | 7 ------- include/asm-generic/hugetlb.h | 9 +++++++++ 10 files changed, 14 insertions(+), 28 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index 8247cd6a2ac6..54e4b097b1f5 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -37,11 +37,4 @@ static inline pte_t huge_ptep_get(pte_t *ptep) return retval; } -static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep, - pte_t pte, int dirty) -{ - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); -} - #endif /* _ASM_ARM_HUGETLB_3LEVEL_H */ diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index f4f69ae5466e..80887abcef7f 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -42,6 +42,7 @@ extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index 49d1f7949f3a..e9b42750fdf5 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -27,13 +27,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep, - pte_t pte, int dirty) -{ - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); -} - static inline pte_t huge_ptep_get(pte_t *ptep) { return *ptep; diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 3dcf5debf8c4..120adc3b2ffd 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -63,6 +63,7 @@ static inline int huge_pte_none(pte_t pte) return !val || (val == (unsigned long)invalid_pte_table); } +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 9c3950ca2974..165b4e5a6f32 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -43,6 +43,7 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, void huge_ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep); +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 69c14ecac133..658bf7136a3c 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -137,6 +137,7 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, flush_hugetlb_page(vma, addr); } +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 8df4004977b9..c87195ae0cfa 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -32,13 +32,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep, - pte_t pte, int dirty) -{ - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); -} - static inline pte_t huge_ptep_get(pte_t *ptep) { return *ptep; diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index c41754a113f3..028a1465fbe7 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -40,6 +40,7 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); } +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty) diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index a3f781f7a264..574d42eb081e 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -13,13 +13,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep, - pte_t pte, int dirty) -{ - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); -} - static inline pte_t huge_ptep_get(pte_t *ptep) { return *ptep; diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index 9b9039845278..f3c99a03ee83 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -110,4 +110,13 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS +static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, + unsigned long addr, pte_t *ptep, + pte_t pte, int dirty) +{ + return ptep_set_access_flags(vma, addr, ptep, pte, dirty); +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */ From patchwork Tue Jul 31 06:01:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 10550093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7CAE139A for ; Tue, 31 Jul 2018 06:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D195D2A6B4 for ; Tue, 31 Jul 2018 06:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B81682A6BA; Tue, 31 Jul 2018 06:15:27 +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 1C5EF2A6B4 for ; Tue, 31 Jul 2018 06:15:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A48F6B0275; Tue, 31 Jul 2018 02:15:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 42C866B0276; Tue, 31 Jul 2018 02:15:26 -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 2F4856B0277; Tue, 31 Jul 2018 02:15:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id C42976B0275 for ; Tue, 31 Jul 2018 02:15:25 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id t10-v6so11060817wrs.17 for ; Mon, 30 Jul 2018 23:15: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=k51UwmNoyVgfD3DzaXS1skTseH+ieZCGr7P7Jmd5E6o=; b=HahLIpwyjZaAkF1biSiC2zSHVwy9FNRr/FIF1GOMngPiV++fA714yGtERqSStCJmZZ TfgJx0Ib3+uIqWa1VK8hzGCYNcPsCLzMQU87vo3jxx7muvoSH8YeoT0tdQnPvm/WnTTI SlYRFn3eG+lHEdKODAqcm+sJHjpiYMwQkfsjkGWs0ybLAUqme1eZvBD/22qy2rhl0ZKi TuYQyceze7ybdrkGw/jUiPdTZ5o05+sdBCoUhM8LjhF8UzOyadNSAFRGG9aJYbfBAc9s uLTZCUoyOQ7USSTNnba7lojVRqlwZ/dfob6oDG+pIQ+GI5J5RhzbAWnVE2oOpbuWzv/w SlOg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Gm-Message-State: AOUpUlFFD6zyfhQYGo2U+3GtZ2vxFulOw7y3Av8wRzWLSZESMDZa2nhj 0LA85ifbFVBQPSSUKy6t0+gZ3B/7rETtHp/V8YwmPN5mN/sIpQDY/b+d+mp9xYOR7L8MHODFC9G owKQlw0ThyEe8QcUEV50aRLN2leBlul43VOvxM8JyMOqMtqxNwmqLPLkik2ssCK0= X-Received: by 2002:adf:c44c:: with SMTP id a12-v6mr20457376wrg.20.1533017725381; Mon, 30 Jul 2018 23:15:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpceiFylfddNU5ZHb8ARcyrl2CAjP+7oF0OSMTbS3R7ta9cQ8hAPqGv3bWOuwLQZLbbHJygU X-Received: by 2002:adf:c44c:: with SMTP id a12-v6mr20457347wrg.20.1533017724644; Mon, 30 Jul 2018 23:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533017724; cv=none; d=google.com; s=arc-20160816; b=nrLQfmMgYGjHMsPDRxIGA4LD6EYTj9Ce6A2Y/zkEdrBJRNm4roHKziOk5/GsTf5fUl 09ymGRubZkWkMmYAcIEdCqap0GN8ZaBxHWFrw5a2qnDPn5DXbfZgElLsF2gw/ToB/O07 d6TJZHya/AGpzz+ANGvvU8oDmcMriyo2elWy4MgpGe/Anpt0SvBJDX1ddj93rWqH0aE1 FKHe0xyuKg04jaUZxxHXF5nFtF2xBU/nNG90Ex7qAYZaajNvU2MVE5bjOza0rixXxM6b mIDH5w2QkDvvbEzBe7OVeDvVhuAXyKdNj0rViKvD4slPqDstzNMFX/xjcDeJbr8wYbE+ ZsRQ== 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=k51UwmNoyVgfD3DzaXS1skTseH+ieZCGr7P7Jmd5E6o=; b=txo7tEWmqyHALRhyvb4jODxb2OrwjjB/pu/ndpyLvZiH0652ktQGryLA1NPK0WQe21 xVNU5DZxUWoMooaI71eoabRoBV+nfGMOPUWkH/ShSBVYFI1sff1eQatpHmjuK5APVqWi P4/GEQzudDvDIVMr5q/GUdJd3v1BuM5qiCGHP3ES5F7pHho0L0J7d8ECEwIk1VIl+hT9 TT78tngywTQ0R9wqKR0podcKnebp78/BSubwA1Fymq+q7vYIsBngguGvc/xfRgQEt4U1 sMCUgkG8om0uvfdGTu7X0YXcnOQjZ4tclJRAQ5tpu33HXztNKCQqSg1g/RyIr1c41O/5 k9xw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net. [217.70.183.197]) by mx.google.com with ESMTPS id x96-v6si14949581wrb.312.2018.07.30.23.15.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 23:15:24 -0700 (PDT) Received-SPF: neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) client-ip=217.70.183.197; Authentication-Results: mx.google.com; spf=neutral (google.com: 217.70.183.197 is neither permitted nor denied by best guess record for domain of alex@ghiti.fr) smtp.mailfrom=alex@ghiti.fr X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 451FD1C0003; Tue, 31 Jul 2018 06:15:19 +0000 (UTC) From: Alexandre Ghiti To: linux-mm@kvack.org, mike.kravetz@oracle.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tony.luck@intel.com, fenghua.yu@intel.com, ralf@linux-mips.org, paul.burton@mips.com, jhogan@kernel.org, jejb@parisc-linux.org, deller@gmx.de, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v5 11/11] hugetlb: Introduce generic version of huge_ptep_get Date: Tue, 31 Jul 2018 06:01:55 +0000 Message-Id: <20180731060155.16915-12-alex@ghiti.fr> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180731060155.16915-1-alex@ghiti.fr> References: <20180731060155.16915-1-alex@ghiti.fr> 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 ia64, mips, parisc, powerpc, sh, sparc, x86 architectures use the same version of huge_ptep_get, so move this generic implementation into asm-generic/hugetlb.h. Signed-off-by: Alexandre Ghiti Reviewed-by: Mike Kravetz --- arch/arm/include/asm/hugetlb-3level.h | 1 + arch/arm64/include/asm/hugetlb.h | 1 + arch/ia64/include/asm/hugetlb.h | 5 ----- arch/mips/include/asm/hugetlb.h | 5 ----- arch/parisc/include/asm/hugetlb.h | 5 ----- arch/powerpc/include/asm/hugetlb.h | 5 ----- arch/sh/include/asm/hugetlb.h | 5 ----- arch/sparc/include/asm/hugetlb.h | 5 ----- arch/x86/include/asm/hugetlb.h | 5 ----- include/asm-generic/hugetlb.h | 7 +++++++ 10 files changed, 9 insertions(+), 35 deletions(-) diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h index 54e4b097b1f5..0d9f3918fa7e 100644 --- a/arch/arm/include/asm/hugetlb-3level.h +++ b/arch/arm/include/asm/hugetlb-3level.h @@ -29,6 +29,7 @@ * ptes. * (The valid bit is automatically cleared by set_pte_at for PROT_NONE ptes). */ +#define __HAVE_ARCH_HUGE_PTEP_GET static inline pte_t huge_ptep_get(pte_t *ptep) { pte_t retval = *ptep; diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 80887abcef7f..fb6609875455 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -20,6 +20,7 @@ #include +#define __HAVE_ARCH_HUGE_PTEP_GET static inline pte_t huge_ptep_get(pte_t *ptep) { return READ_ONCE(*ptep); diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h index e9b42750fdf5..36cc0396b214 100644 --- a/arch/ia64/include/asm/hugetlb.h +++ b/arch/ia64/include/asm/hugetlb.h @@ -27,11 +27,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h index 120adc3b2ffd..425bb6fc3bda 100644 --- a/arch/mips/include/asm/hugetlb.h +++ b/arch/mips/include/asm/hugetlb.h @@ -82,11 +82,6 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, return changed; } -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/arch/parisc/include/asm/hugetlb.h b/arch/parisc/include/asm/hugetlb.h index 165b4e5a6f32..7cb595dcb7d7 100644 --- a/arch/parisc/include/asm/hugetlb.h +++ b/arch/parisc/include/asm/hugetlb.h @@ -48,11 +48,6 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 658bf7136a3c..33a2d9e3ea9e 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h @@ -142,11 +142,6 @@ extern int huge_ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep, pte_t pte, int dirty); -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index c87195ae0cfa..6f025fe18146 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -32,11 +32,6 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, { } -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { clear_bit(PG_dcache_clean, &page->flags); diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h index 028a1465fbe7..3963f80d1cb3 100644 --- a/arch/sparc/include/asm/hugetlb.h +++ b/arch/sparc/include/asm/hugetlb.h @@ -53,11 +53,6 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, return changed; } -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h index 574d42eb081e..7469d321f072 100644 --- a/arch/x86/include/asm/hugetlb.h +++ b/arch/x86/include/asm/hugetlb.h @@ -13,11 +13,6 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, return 0; } -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - static inline void arch_clear_hugepage_flags(struct page *page) { } diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h index f3c99a03ee83..71d7b77eea50 100644 --- a/include/asm-generic/hugetlb.h +++ b/include/asm-generic/hugetlb.h @@ -119,4 +119,11 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, } #endif +#ifndef __HAVE_ARCH_HUGE_PTEP_GET +static inline pte_t huge_ptep_get(pte_t *ptep) +{ + return *ptep; +} +#endif + #endif /* _ASM_GENERIC_HUGETLB_H */