Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2837180pjo; Mon, 16 Mar 2020 05:38:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vty9Q68leC8MaHKAedRQblTC9YvK/NbOjW4kT/ufiI++30DkzkGHdq0cHh12Fi/lQGQbD01 X-Received: by 2002:aca:aa81:: with SMTP id t123mr4395991oie.117.1584362315316; Mon, 16 Mar 2020 05:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362315; cv=none; d=google.com; s=arc-20160816; b=Fm2aoRvwT8nGOPX82UEQFbkBmlR5oSs2gR6EN1Mc4v4uNPr0BUXfbbCcT3seET+0Gl h3DKzJ5QRCUW8Z5oBfRtYNrA1aQk/fPuI2PkvWIR/ViWHIlnF5wF1Uk+ukEF0bZRHFZO 2dUxKIG2uMvXJGoTULipooGXdZOchTAOpYHjjIanyeguuyuuVwoV1r+uZzByGC4qPJck wYbSaF7Fm3uSBHlIjBa9QtLKU/Qk1eh3rCuK/PgqnQ++RZw5Rfon6RjTsf07kIfKBmu7 ambHkmb1koTMxnHa6jdZkM8I8wQzt/diUh4odV9uLlie1OLh1LgE1E3aMMW7JJ+rdfGp C6Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=+r3Uvs2NtrSKSiP3s1jpNGh3Th8SL2VqTSytf4YScZ4=; b=TObZ7pTe5nFXHZW7xf9sLvimzc/Sl/zDMZB6MRMw+RdRKkvReM+hjZfoLmUoDgmsmX Cm1LytJ6CsEWofbpxjpsXEBTacFa0y913Zt8hcaSGD3Jf2MesOO6l3CYRWSkZjVH7LD5 V+TN3LZOEEYK6IrBDcdAul+W54Q8GDRYWKCYx45LAfUsuNTXEVYlziOby8xZ7BVWDv3h XFymVsx24YPm7bs9tZVrJlX7KzL5Qnlnzkg9wVawwQxIanBCq0rKvWzT9vquv8UrJlty ycrWjOrDAM0dD6uf1mJ4IeFjmVMyhD238g4d2fWQCXuGnfCwGSoi705JHgKj30WA+jvk pDkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=V+eQ96TP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o124si7565680oib.111.2020.03.16.05.38.23; Mon, 16 Mar 2020 05:38:35 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=V+eQ96TP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731119AbgCPMhb (ORCPT + 99 others); Mon, 16 Mar 2020 08:37:31 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:41784 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731199AbgCPMgP (ORCPT ); Mon, 16 Mar 2020 08:36:15 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwlF1x5Yz9v02h; Mon, 16 Mar 2020 13:36:09 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=V+eQ96TP; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 9bdRDHnPwipI; Mon, 16 Mar 2020 13:36:09 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48gwlF0lZLz9v02f; Mon, 16 Mar 2020 13:36:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362169; bh=+r3Uvs2NtrSKSiP3s1jpNGh3Th8SL2VqTSytf4YScZ4=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=V+eQ96TPp3u3xmKIbOsbK5oIg7eFSGjt+Dw9pDe5z3WHsU7sgdf+zBGAzpKetsQ7Z pUVHHn+1czKfg70bULXccIVnBpbNtnLJpUCidlzwvLJnMU0EwQHEWVfVvxJib0WBL3 qkczsSD/kW5LQ0y2MeoLH4Z0IkwrJ8RalH9YtJJc= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 117808B7D0; Mon, 16 Mar 2020 13:36:14 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Rxv6_hnFHVdB; Mon, 16 Mar 2020 13:36:14 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E33D48B7CB; Mon, 16 Mar 2020 13:36:13 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id D819065595; Mon, 16 Mar 2020 12:36:13 +0000 (UTC) Message-Id: <74c690b4b60bf414eaa1463864a42e51fc798856.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 28/46] powerpc/8xx: Only 8M pages are hugepte pages now To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:36:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 512k pages are now standard pages, so only 8M pages are hugepte. No more handling of normal page tables through hugepd allocation and freeing, and hugepte helpers can also be simplified. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 7 +++---- arch/powerpc/mm/hugetlbpage.c | 16 +++------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h index 785437323576..1c7d4693a78e 100644 --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h @@ -13,13 +13,13 @@ static inline pte_t *hugepd_page(hugepd_t hpd) static inline unsigned int hugepd_shift(hugepd_t hpd) { - return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17; + return PAGE_SHIFT_8M; } static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, unsigned int pdshift) { - unsigned long idx = (addr & ((1UL << pdshift) - 1)) >> PAGE_SHIFT; + unsigned long idx = (addr & (SZ_4M - 1)) >> PAGE_SHIFT; return hugepd_page(hpd) + idx; } @@ -32,8 +32,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, static inline void hugepd_populate(hugepd_t *hpdp, pte_t *new, unsigned int pshift) { - *hpdp = __hugepd(__pa(new) | _PMD_USER | _PMD_PRESENT | - (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : _PMD_PAGE_512K)); + *hpdp = __hugepd(__pa(new) | _PMD_USER | _PMD_PRESENT | _PMD_PAGE_8M); } static inline int check_and_get_huge_psize(int shift) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 35eb29584b54..243e90db400c 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -54,24 +54,17 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, if (pshift >= pdshift) { cachep = PGT_CACHE(PTE_T_ORDER); num_hugepd = 1 << (pshift - pdshift); - new = NULL; - } else if (IS_ENABLED(CONFIG_PPC_8xx)) { - cachep = NULL; - num_hugepd = 1; - new = pte_alloc_one(mm); } else { cachep = PGT_CACHE(pdshift - pshift); num_hugepd = 1; - new = NULL; } - if (!cachep && !new) { + if (!cachep) { WARN_ONCE(1, "No page table cache created for hugetlb tables"); return -ENOMEM; } - if (cachep) - new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL)); + new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL)); BUG_ON(pshift > HUGEPD_SHIFT_MASK); BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK); @@ -102,10 +95,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, if (i < num_hugepd) { for (i = i - 1 ; i >= 0; i--, hpdp--) *hpdp = __hugepd(0); - if (cachep) - kmem_cache_free(cachep, new); - else - pte_free(mm, new); + kmem_cache_free(cachep, new); } else { kmemleak_ignore(new); } -- 2.25.0