Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp402427img; Wed, 20 Mar 2019 03:08:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKsVRnJQ3/JKEidwQjot75iDWEOZVMWoel3axu8Fkk8CEvUrcU/A/gvEFoulR7gDjBtRlt X-Received: by 2002:a62:41cc:: with SMTP id g73mr7111633pfd.145.1553076516694; Wed, 20 Mar 2019 03:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553076516; cv=none; d=google.com; s=arc-20160816; b=t8MNkopbX274n2WyWoiPPc4eJEPkl7OTLLOYHDkm02N71/XrcUMydFzYYEZ/2KnCKE U72RLZHQMUde+67NRYA4MCQWJnb18QqNI/NEK1QH9BtkE/8LU7r1eHJvFGVVyyEGIAxa Ze3AgBOLwW8Yy0XYRoXZiFKWMOhTsSxyujwuB3vXxQZT/JYV2FFQ7xIW86uV9OZSq4Hv Qd0UXROINk9LmDgMC9hMK0COzpSdcuAEk0WH7MrmTq5ZUVJHWl+T1TYubZGzsDSj8CJH VKx+UHrzaIBphTluolTBa4bK021dFLJVyn+37RsyWuNBcGm+B2EQU+qepg6j44NYnDAE bUNA== 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=CdZAWtK1Toi2PIHVI6vPbGzH/nxkdPNYtkmYkbl6Eek=; b=nSer+3gI3D0zymmNRPy5RsIIJ9+0VX10GzPZvbNRW/+alSAk3aEUb77cPkd6eKz1mQ AfjsHgFbVb2c4Pb8SReWM4OxkW4QXVlRlttZ+rXB4P+/3AUWzqGXNVFJc9SAwQ0015AO c17ExsuSfHgJ8RTUBYddupYR6cbq8BmtbMql4AQhl1czhBcS+Tc/LqfjqUJgtZuKrRBr fBQFeFqdlzyj8Bfx5K0pFXyhyu8o86rjRhLtiWlqjxtMh1PMYF5qoViwfH2C6/GIsz0w +etgxizv0CW3OFn788JyIBW+lueGZZYM1KxaUCwLslVbGPkz48N0qilV27fncgQYksjT jM9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=wBCCXFLl; 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 v7si1326340pgk.464.2019.03.20.03.08.20; Wed, 20 Mar 2019 03:08:36 -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=wBCCXFLl; 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 S1727950AbfCTKHP (ORCPT + 99 others); Wed, 20 Mar 2019 06:07:15 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:46545 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727913AbfCTKHG (ORCPT ); Wed, 20 Mar 2019 06:07:06 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44PQZH2WJrz9vC0F; Wed, 20 Mar 2019 11:07:03 +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=wBCCXFLl; 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 Qc30ovKrnmWj; Wed, 20 Mar 2019 11:07:03 +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 44PQZH1Mjtz9vByx; Wed, 20 Mar 2019 11:07:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1553076423; bh=CdZAWtK1Toi2PIHVI6vPbGzH/nxkdPNYtkmYkbl6Eek=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=wBCCXFLl8+LLINJAcT6HLC9Ob0NbFJOPG0MDHrkuU2O0ItJXcHLrLcoJdTMjLN+SJ G5SFQqNtZV/2YhKBIIVn1tblcwUWYjpNh4R7XNmrZZ4e0jpYe3O8/joQHPZ1k5fkT6 MG+CdDLcBabThEMeBZAANsdrp90c8c5gvuA/5oEE= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4FBDE8B918; Wed, 20 Mar 2019 11:07:04 +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 RyJ_qZ2MplYv; Wed, 20 Mar 2019 11:07:04 +0100 (CET) Received: from po16846vm.idsi0.si.c-s.fr (unknown [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2AFD38B911; Wed, 20 Mar 2019 11:07:04 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id E7E5163AEF; Wed, 20 Mar 2019 10:07:03 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 27/27] powerpc/mm: flatten function __find_linux_pte() step 3 To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , aneesh.kumar@linux.ibm.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 20 Mar 2019 10:07:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __find_linux_pte() is full of if/else which is hard to follow allthough the handling is pretty simple. Previous patches left a { } block. This patch removes it. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/pgtable.c | 98 +++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index c1c6d0b79baa..db4a6253df92 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -348,59 +348,59 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea, hpdp = (hugepd_t *)&pgd; goto out_huge; } - { - /* - * Even if we end up with an unmap, the pgtable will not - * be freed, because we do an rcu free and here we are - * irq disabled - */ - pdshift = PUD_SHIFT; - pudp = pud_offset(&pgd, ea); - pud = READ_ONCE(*pudp); - if (pud_none(pud)) - return NULL; + /* + * Even if we end up with an unmap, the pgtable will not + * be freed, because we do an rcu free and here we are + * irq disabled + */ + pdshift = PUD_SHIFT; + pudp = pud_offset(&pgd, ea); + pud = READ_ONCE(*pudp); - if (pud_huge(pud)) { - ret_pte = (pte_t *) pudp; - goto out; - } - if (is_hugepd(__hugepd(pud_val(pud)))) { - hpdp = (hugepd_t *)&pud; - goto out_huge; - } - pdshift = PMD_SHIFT; - pmdp = pmd_offset(&pud, ea); - pmd = READ_ONCE(*pmdp); - /* - * A hugepage collapse is captured by pmd_none, because - * it mark the pmd none and do a hpte invalidate. - */ - if (pmd_none(pmd)) - return NULL; - - if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) { - if (is_thp) - *is_thp = true; - ret_pte = (pte_t *)pmdp; - goto out; - } - /* - * pmd_large check below will handle the swap pmd pte - * we need to do both the check because they are config - * dependent. - */ - if (pmd_huge(pmd) || pmd_large(pmd)) { - ret_pte = (pte_t *)pmdp; - goto out; - } - if (is_hugepd(__hugepd(pmd_val(pmd)))) { - hpdp = (hugepd_t *)&pmd; - goto out_huge; - } + if (pud_none(pud)) + return NULL; - return pte_offset_kernel(&pmd, ea); + if (pud_huge(pud)) { + ret_pte = (pte_t *)pudp; + goto out; } + if (is_hugepd(__hugepd(pud_val(pud)))) { + hpdp = (hugepd_t *)&pud; + goto out_huge; + } + pdshift = PMD_SHIFT; + pmdp = pmd_offset(&pud, ea); + pmd = READ_ONCE(*pmdp); + /* + * A hugepage collapse is captured by pmd_none, because + * it mark the pmd none and do a hpte invalidate. + */ + if (pmd_none(pmd)) + return NULL; + + if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) { + if (is_thp) + *is_thp = true; + ret_pte = (pte_t *)pmdp; + goto out; + } + /* + * pmd_large check below will handle the swap pmd pte + * we need to do both the check because they are config + * dependent. + */ + if (pmd_huge(pmd) || pmd_large(pmd)) { + ret_pte = (pte_t *)pmdp; + goto out; + } + if (is_hugepd(__hugepd(pmd_val(pmd)))) { + hpdp = (hugepd_t *)&pmd; + goto out_huge; + } + + return pte_offset_kernel(&pmd, ea); + out_huge: if (!hpdp) return NULL; -- 2.13.3