Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7365519yba; Thu, 2 May 2019 08:40:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxXwMzIlIk3v3GgYvVKJmdN8PbLZ1o+p0EEh89+qeuUyVOuejmThbqn+BjJ1eRH7YzYed7 X-Received: by 2002:a62:a515:: with SMTP id v21mr4975319pfm.41.1556811610060; Thu, 02 May 2019 08:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556811610; cv=none; d=google.com; s=arc-20160816; b=gFSEAe/hogNCRPk4hzOVVdgF84M2oTn6MCqJg2ciAv47O0KJC9rX9wizFRiOhpqdfI Iox5Pcv1d5RcZah7oPXVpXnn5mSWXROnFxQ25hiSOyyKsybZgAXvSPb0+Qz/yukZTZwi J2BOYMzVVhulMc6cYDJ/MbYY0tO2yoIL1jEMK7DGv08XPJsy/hPLoISflTxT7O4HbzeR q9+WuwykPPyi+qeSxrv7oiat5SyRQUtUYZjYWLWIgteaWHCUs2SvKkqGt4wunkHxevTt Vs/npNo8JlkADl6bjq6+soln4HTPuZQIg/2VTBw199tbjOJtLIgXn2bBm/gJe8sKujEC GUPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=t+IPLYZcXXRjpW7mZzEwC5UWDJDXximLY+G0RzeC42o=; b=jsJSVXgUySBVdxc+vuduuXfu5hcOHhVMxbvMFRwS3NhRcUoy7Kc3CHxs2ZSRPXTjdP 5U7iCjrHq2zhtuuK0gzbShHOd/fOivR7NVpHEQqZakdewfNIqd16j9EMipR4HnUzcb6x ziWb/PqdeOjGeRPa3oVgE2Q3FAltLgK5kQTbcqNi2eyGFBx458TBswPnTtbRYLIGG2qQ SnJnUqahZ6dG/3hEAvv2/gXiPDW22aCKKjaY5UKePNRYWOp822FsAGwoZ7uTT8+ZANJ1 0g2omnfqEzUuHljn0mZ2+G7CN/FYFXzxaysm9loOqd+YCgFFq45acJY8Lcl3HQn1Za3U N3Sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si47950458pfb.75.2019.05.02.08.39.53; Thu, 02 May 2019 08:40:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728636AbfEBPaF (ORCPT + 99 others); Thu, 2 May 2019 11:30:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50928 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728591AbfEBPaC (ORCPT ); Thu, 2 May 2019 11:30:02 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x42FTpHw076179 for ; Thu, 2 May 2019 11:30:02 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2s81chnupr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 02 May 2019 11:29:57 -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 Cc: Arnd Bergmann , Catalin Marinas , Geert Uytterhoeven , Greentime Hu , Guan Xuetao , Guo Ren , Helge Deller , Ley Foon Tan , Matthew Wilcox , Matt Turner , Michael Ellerman , Michal Hocko , Palmer Dabbelt , Paul Burton , Richard Kuo , Richard Weinberger , Russell King , Sam Creasey , x86@kernel.org, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-um@lists.infradead.org, nios2-dev@lists.rocketboards.org, Mike Rapoport 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=207 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905020103 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4