From patchwork Thu May 2 15:28:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10927339 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 D9B7C1395 for ; Thu, 2 May 2019 16:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7B6B1FF28 for ; Thu, 2 May 2019 16:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBCAE20500; Thu, 2 May 2019 16:32:00 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5923D1FF28 for ; Thu, 2 May 2019 16:32:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=FI2z6e8yoGGsQ5lHANO7JFh7cIhKOmjJpglBE3qEAf8=; b=r4y QlqhTMjyqEa5oGKgWBebmh1ljpTg8gaeK1ZxGXkrU7RCrx64NzCClhu4+6qOlAcN1Axl8plV8qmCG C0fkhGAzzyjMbhtvDS0GRR6bSW14998zLGn8XSJ6fGMbtgc8dOP5Jg9QaOGTMxlczVGvE/IThVZOd UfgZX0cVctVSTzms1nWBmN2EojKSsb2nuD58slaE0kAobQDM4LHc6f5piULrP7S3fsP79h9gcZIW7 jzTfapWsX5Ago08zCLPKV7BIgggVPI+ga1TyftNOy6T2N3aP2gRLzFbmpOTZN4B0QDqQKBrONBw54 c10zreII7hXC+fIyNHxmaL8pR3TPP5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMEco-0003bN-7y; Thu, 02 May 2019 16:31:58 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMEc8-0002PU-IS for linux-arm-kernel@bombadil.infradead.org; Thu, 02 May 2019 16:31:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=t+IPLYZcXXRjpW7mZzEwC5UWDJDXximLY+G0RzeC42o=; b=hLtsozlyO4wDiJvwwcOF1FUIh UntEgN/EXZRNcKm53ALYCXVJUUefh/Bhax9E2wFyS/e1isxLAuu3/V+VNVuDmFJcYSwfinTIaubZg veoNjfYnw4kkPoaf2Y21JLBR/TMVBSPHbcWYsMtmOQTqzVggb94g8tN0FusOrK/4aQe5TD4TWSgu8 Fb3GyUwGTmi0naTNuH/G+vzJBt8ZpsO8TrIkpn9twvItklAz82r1/+hIPw8gVOQP9E60IMOjZ25xf 3gOgXPosRX17o+CCaNzJ3MdfKMjy6135GmdCCDQP00dJoGH4012mcG1Ww6PpSiCh5UGNatJc1Zd0S qVFwdShSQ==; Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMDen-0000EM-87 for linux-arm-kernel@lists.infradead.org; Thu, 02 May 2019 15:29:58 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x42FTrQp022693 for ; Thu, 2 May 2019 11:29:56 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2s82n3hq90-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 May 2019 11:29:55 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 2 May 2019 16:28:58 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Thu, 2 May 2019 16:28:50 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x42FSnXd45023486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 May 2019 15:28:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 830D5A4051; Thu, 2 May 2019 15:28:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12855A404D; Thu, 2 May 2019 15:28:45 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.205.209]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 2 May 2019 15:28:44 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Thu, 02 May 2019 18:28:43 +0300 From: Mike Rapoport To: Andrew Morton Subject: [PATCH 00/15] introduce generic pte_{alloc,free}_one[_kernel] Date: Thu, 2 May 2019 18:28:27 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 19050215-0008-0000-0000-000002E29914 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19050215-0009-0000-0000-0000224F082B Message-Id: <1556810922-20248-1-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-02_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=1 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=1 clxscore=1015 lowpriorityscore=0 mlxscore=1 impostorscore=0 mlxlogscore=199 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905020103 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190502_112957_349650_4AC1FC39 X-CRM114-Status: GOOD ( 24.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Catalin Marinas , Palmer Dabbelt , linux-mips@vger.kernel.org, Guo Ren , linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, Michael Ellerman , Helge Deller , x86@kernel.org, Russell King , Matthew Wilcox , Mike Rapoport , Geert Uytterhoeven , Matt Turner , Sam Creasey , Arnd Bergmann , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, I've tried to trim down the recipients list, but it's still quite long, so sorry for the spam. 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. [1] https://lore.kernel.org/lkml/1547619692-7946-1-git-send-email-anshuman.khandual@arm.com asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel] Mike Rapoport (15): 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 powerpc/nohash/64: 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 | 43 +---------- arch/arm64/mm/mmu.c | 2 +- arch/arm64/mm/pgd.c | 4 +- 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/powerpc/include/asm/nohash/64/pgalloc.h | 35 +-------- 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 +- 22 files changed, 171 insertions(+), 499 deletions(-)