From patchwork Wed May 8 06:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 1096711 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44zRCz20Gvz9sMM for ; Wed, 8 May 2019 16:20:15 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44zRCz0GHSzDqG0 for ; Wed, 8 May 2019 16:20:15 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=rppt@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44zR8v0TXSzDqK9 for ; Wed, 8 May 2019 16:17:33 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x486GcS6072893 for ; Wed, 8 May 2019 02:17:29 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sbp870cxn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 08 May 2019 02:17:29 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 May 2019 07:17:27 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 8 May 2019 07:17:17 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x486HGdZ56426730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 May 2019 06:17:16 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1500A405F; Wed, 8 May 2019 06:17:16 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C43EA406B; Wed, 8 May 2019 06:17:13 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.112]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 8 May 2019 06:17:13 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Wed, 08 May 2019 09:17:12 +0300 From: Mike Rapoport To: Andrew Morton Subject: [PATCH v2 00/14] introduce generic pte_{alloc,free}_one[_kernel] Date: Wed, 8 May 2019 09:16:57 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 19050806-0008-0000-0000-000002E466E7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19050806-0009-0000-0000-00002250E6BE Message-Id: <1557296232-15361-1-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-08_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=412 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905080040 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Catalin Marinas , Palmer Dabbelt , linux-mips@vger.kernel.org, linux-mm@kvack.org, Guo Ren , linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, Helge Deller , x86@kernel.org, Russell King , Matthew Wilcox , Mike Rapoport , Geert Uytterhoeven , Matt Turner , Sam Creasey , Arnd Bergmann , Anshuman Khandual , linux-um@lists.infradead.org, Richard Weinberger , linux-m68k@lists.linux-m68k.org, Greentime Hu , nios2-dev@lists.rocketboards.org, Guan Xuetao , linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Kuo , Paul Burton , linux-alpha@vger.kernel.org, Ley Foon Tan , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi, Many architectures have similar, if not identical implementation of pte_alloc_one_kernel(), pte_alloc_one(), pte_free_kernel() and pte_free(). A while ago Anshuman suggested to introduce a common definition of GFP_PGTABLE and during the discussion it was suggested to rather consolidate the allocators. These patches introduce generic version of PTE allocation and free and enable their use on several architectures. The conversion introduces some changes for some of the architectures. Here's the executive summary and the details are described at each patch. * Most architectures do not set __GFP_ACCOUNT for the user page tables. Switch to the generic functions is "spreading that goodness to all other architectures" * arm, arm64 and unicore32 used to check if the pte is not NULL before freeing its memory in pte_free_kernel(). It's dropped during the conversion as it seems superfluous. * x86 used to BUG_ON() is pte was not page aligned duirng pte_free_kernel(), the generic version simply frees the memory without any checks. This set only performs the straightforward conversion, the architectures with different logic in pte_alloc_one() and pte_alloc_one_kernel() are not touched, as well as architectures that have custom page table allocators. v2 changes: * rebase on the current upstream * fix copy-paste error in the description of pte_free() * fix changelog for MIPS to match actual changes * drop powerpc changes * add Acked/Reviewed tags [1] https://lore.kernel.org/lkml/1547619692-7946-1-git-send-email-anshuman.khandual@arm.com Mike Rapoport (14): asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel] alpha: switch to generic version of pte allocation arm: switch to generic version of pte allocation arm64: switch to generic version of pte allocation csky: switch to generic version of pte allocation hexagon: switch to generic version of pte allocation m68k: sun3: switch to generic version of pte allocation mips: switch to generic version of pte allocation nds32: switch to generic version of pte allocation nios2: switch to generic version of pte allocation parisc: switch to generic version of pte allocation riscv: switch to generic version of pte allocation um: switch to generic version of pte allocation unicore32: switch to generic version of pte allocation arch/alpha/include/asm/pgalloc.h | 40 +------------ arch/arm/include/asm/pgalloc.h | 41 +++++--------- arch/arm/mm/mmu.c | 2 +- arch/arm64/include/asm/pgalloc.h | 47 +++------------ arch/arm64/mm/mmu.c | 2 +- arch/arm64/mm/pgd.c | 9 ++- arch/csky/include/asm/pgalloc.h | 30 +--------- arch/hexagon/include/asm/pgalloc.h | 34 +---------- arch/m68k/include/asm/sun3_pgalloc.h | 41 +------------- arch/mips/include/asm/pgalloc.h | 33 +---------- arch/nds32/include/asm/pgalloc.h | 31 ++-------- arch/nios2/include/asm/pgalloc.h | 37 +----------- arch/parisc/include/asm/pgalloc.h | 33 +---------- arch/riscv/include/asm/pgalloc.h | 29 +--------- arch/um/include/asm/pgalloc.h | 16 +----- arch/um/kernel/mem.c | 22 ------- arch/unicore32/include/asm/pgalloc.h | 36 +++--------- arch/x86/include/asm/pgalloc.h | 19 +------ arch/x86/mm/pgtable.c | 33 +++-------- include/asm-generic/pgalloc.h | 107 +++++++++++++++++++++++++++++++++-- virt/kvm/arm/mmu.c | 2 +- 21 files changed, 178 insertions(+), 466 deletions(-)