Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3593869ybx; Sun, 3 Nov 2019 23:00:15 -0800 (PST) X-Google-Smtp-Source: APXvYqySLWyCxHqTFtDetHo0IIA6Qw788aRafUFSH/FaJaRFxw22tMaR+eyZ0x4bVwX++aKsJNfW X-Received: by 2002:a17:906:a0f:: with SMTP id w15mr21604414ejf.321.1572850815839; Sun, 03 Nov 2019 23:00:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572850815; cv=none; d=google.com; s=arc-20160816; b=PLHJeob5lp0eSVJS2Ia4dkDDTLUyrZmH6yhyWwIK3Hc+aZ1tTKj6sXiVEijDmsrx6B mjdIFdJQjR4g69fKnID4VLb95GjS1HEkTR6oH6f6Qj+oh0NFMTzSKP5VIC6iLnw8grXV XxrOuFDstKog1LYO5S3dSOOZzi3wyQZqY2L+lmXKZv67NFJzXutj+bbGH7F/lW2JEbu/ nv5e+uBa56PmBa83OO+go92R3QskEhfZ+vUjZyRE9ulIocAN4ob5JG080ZpKzHNB2pmF ySc5eSK7hXDCqHJsJIZRd06KXRg8UMNbcGf5spi7XP/sdHAOclv47KeysAsK763i+iin RQOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=xAl+CIf0xl/Gmj2Xd3Kt627t2Fo8KQ0bleuWtBaYwt0=; b=uT7/XY/JBYQfrT77XloFF/bv59ub99BtuEyu4cnR+9cH9tJUdWs1pmQkuBqYb2IKHn ykNo2TnvizRXv4BG4B7cX5eZ2s5GBFO2Ta1oqjvr855Ooiummu+1Fvx3423lIk3AQ5Ym srUB5yk6kWvsY5ZR4DFc+WsZHbHMeIYkjoKDIWJVz+3IklXvz1L+BpTA5zbFzbWqZqUr iKl3jbpos1FdugHmsAhHqEkhlT0KbM38nlyUbVE/V9flGg6eDt/XDojoD8tDMGi69cdw Z33z9ckEYQ/c2zZyexJYfrgBk2KXGSD4FosnPCVSzHVPgiCIX/xVo9bMCpyHyKE0NfUk BTOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wr+WMJEC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si5865735edq.227.2019.11.03.22.59.52; Sun, 03 Nov 2019 23:00:15 -0800 (PST) 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=@kernel.org header.s=default header.b=Wr+WMJEC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728729AbfKDG6m (ORCPT + 99 others); Mon, 4 Nov 2019 01:58:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:34754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728707AbfKDG6l (ORCPT ); Mon, 4 Nov 2019 01:58:41 -0500 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 60C4722468; Mon, 4 Nov 2019 06:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572850719; bh=0lGj0AI/IfAJbVTLRfdK6fD/lMA7GlT+qoua/5oNwys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wr+WMJECeH/M1Pn3KdzWLNvJHglih66+/tqZrVLvVIkAOW6resJH3KFuVOfbUwbpP 3Ee4i/8/TFA20e/QQnyzLRrGm4sRjhKrakK9B4M9D00SEX3C8nuPZRRAgDo3/DhADp pcy3WvSnO0+rQyqTHc/Hb+lkcykYgUuRVFwvTDHU= From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , Anton Ivanov , Arnd Bergmann , "David S. Miller" , Geert Uytterhoeven , Greentime Hu , Greg Ungerer , Helge Deller , "James E.J. Bottomley" , Jeff Dike , "Kirill A. Shutemov" , Linus Torvalds , Mark Salter , Matt Turner , Michal Simek , Peter Rosin , Richard Weinberger , Rolf Eike Beer , Russell King , Sam Creasey , Vincent Chen , Vineet Gupta , Mike Rapoport , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-parisc@vger.kernel.org, linux-um@lists.infradead.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH v3 13/13] mm: remove __ARCH_HAS_4LEVEL_HACK and include/asm-generic/4level-fixup.h Date: Mon, 4 Nov 2019 08:56:27 +0200 Message-Id: <1572850587-20314-14-git-send-email-rppt@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1572850587-20314-1-git-send-email-rppt@kernel.org> References: <1572850587-20314-1-git-send-email-rppt@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport There are no architectures that use include/asm-generic/4level-fixup.h therefore it can be removed along with __ARCH_HAS_4LEVEL_HACK define. Signed-off-by: Mike Rapoport --- include/asm-generic/4level-fixup.h | 40 -------------------------------------- include/asm-generic/tlb.h | 2 -- include/linux/mm.h | 10 +++++----- mm/memory.c | 8 -------- 4 files changed, 5 insertions(+), 55 deletions(-) delete mode 100644 include/asm-generic/4level-fixup.h diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h deleted file mode 100644 index e3667c9..0000000 --- a/include/asm-generic/4level-fixup.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _4LEVEL_FIXUP_H -#define _4LEVEL_FIXUP_H - -#define __ARCH_HAS_4LEVEL_HACK -#define __PAGETABLE_PUD_FOLDED 1 - -#define PUD_SHIFT PGDIR_SHIFT -#define PUD_SIZE PGDIR_SIZE -#define PUD_MASK PGDIR_MASK -#define PTRS_PER_PUD 1 - -#define pud_t pgd_t - -#define pmd_alloc(mm, pud, address) \ - ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \ - NULL: pmd_offset(pud, address)) - -#define pud_offset(pgd, start) (pgd) -#define pud_none(pud) 0 -#define pud_bad(pud) 0 -#define pud_present(pud) 1 -#define pud_ERROR(pud) do { } while (0) -#define pud_clear(pud) pgd_clear(pud) -#define pud_val(pud) pgd_val(pud) -#define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd) -#define pud_page(pud) pgd_page(pud) -#define pud_page_vaddr(pud) pgd_page_vaddr(pud) - -#undef pud_free_tlb -#define pud_free_tlb(tlb, x, addr) do { } while (0) -#define pud_free(mm, x) do { } while (0) -#define __pud_free_tlb(tlb, x, addr) do { } while (0) - -#undef pud_addr_end -#define pud_addr_end(addr, end) (end) - -#include - -#endif diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 04c0644..5e0c2d0 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -584,7 +584,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm } while (0) #endif -#ifndef __ARCH_HAS_4LEVEL_HACK #ifndef pud_free_tlb #define pud_free_tlb(tlb, pudp, address) \ do { \ @@ -594,7 +593,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm __pud_free_tlb(tlb, pudp, address); \ } while (0) #endif -#endif #ifndef __ARCH_HAS_5LEVEL_HACK #ifndef p4d_free_tlb diff --git a/include/linux/mm.h b/include/linux/mm.h index cc29227..477b52a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1850,12 +1850,12 @@ static inline void mm_dec_nr_ptes(struct mm_struct *mm) {} int __pte_alloc(struct mm_struct *mm, pmd_t *pmd); int __pte_alloc_kernel(pmd_t *pmd); +#if defined(CONFIG_MMU) + /* - * The following ifdef needed to get the 4level-fixup.h header to work. - * Remove it when 4level-fixup.h has been removed. + * The following ifdef needed to get the 5level-fixup.h header to work. + * Remove it when 5level-fixup.h has been removed. */ -#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK) - #ifndef __ARCH_HAS_5LEVEL_HACK static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) @@ -1877,7 +1877,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))? NULL: pmd_offset(pud, address); } -#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ +#endif /* CONFIG_MMU */ #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS diff --git a/mm/memory.c b/mm/memory.c index b1ca51a..50300f0 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4095,19 +4095,11 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) smp_wmb(); /* See comment in __pte_alloc */ ptl = pud_lock(mm, pud); -#ifndef __ARCH_HAS_4LEVEL_HACK if (!pud_present(*pud)) { mm_inc_nr_pmds(mm); pud_populate(mm, pud, new); } else /* Another has populated it */ pmd_free(mm, new); -#else - if (!pgd_present(*pud)) { - mm_inc_nr_pmds(mm); - pgd_populate(mm, pud, new); - } else /* Another has populated it */ - pmd_free(mm, new); -#endif /* __ARCH_HAS_4LEVEL_HACK */ spin_unlock(ptl); return 0; } -- 2.7.4