Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp270731yba; Thu, 25 Apr 2019 23:02:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxe8yhSZxtgEAgvFmaIlESYMpSYoMwqzzLHwbNDPMwJYcfyLXiQQhIIpEmtIyHXDJ9Jkw8Z X-Received: by 2002:a63:f707:: with SMTP id x7mr41226911pgh.343.1556258548611; Thu, 25 Apr 2019 23:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556258548; cv=none; d=google.com; s=arc-20160816; b=lYWR5hqKP+BhYwWX2cQOfmq/Imy6ZDLSY0DxS188YQxu1qdvRbABxvQ8iJROq7IceU iAEWDkO6ePWJxiSiKfY36FWMK67ZSQQwBL3rAp+P4ozu1h5Wrxa5fZmZiTT2qVacnn8g OCfN0heBa/gft/OgOibjrWJkZKCJqxMBCsS4gvt9Y8YvhVib/UFqjx2vI36fKnsprf9F B33yVY/VKhCgvJqUv1GJiYlWPIi0l+HXm0wPV8V8Xvyy1R2vYKnqQm6aRAYSLd/eXLkt 8AZVAO7jZbGHXkKjHPYJ88yWsx7Ok8F1tNXaa09TfDBlzDCZ4Yzfez/l4YvmPfvTO2ts 7BVg== 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=vxRaAWDmZsFUBwz4iKvey5ojXSp+AdkM5ULQTRgmRYR/1YVW2T0yFlS1VYLf2z0UKW 3fs4nCt4e9E/LzslsHqHF/NSV0EZxlWUZF2bONkMKZEzQruYiJSef3NbRoOqCiKwi7gR w6FjSeu2uSzUmMoXK7B0S1Dbb6YhckxLBYTp8jvqyXjm3an5jxtrgTiJxVqIt1GYU2cB KKhNBtHd2/77H8Y2HhK2vWcdGdi7HSFaGbUTe19Q2UstoIpPMeojexEae2m8DSw0BuAe PVFiASSEWMmdclkP8y0cZlEDq3sW5jjjSzp/ZaLL05AeiojDGPFtZ9KKzAeUPFQzIWvR njkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="cj/deBlo"; 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 j1si24577523pfc.194.2019.04.25.23.02.12; Thu, 25 Apr 2019 23:02:28 -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="cj/deBlo"; 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 S1727170AbfDZF74 (ORCPT + 99 others); Fri, 26 Apr 2019 01:59:56 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:20319 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727099AbfDZF7z (ORCPT ); Fri, 26 Apr 2019 01:59:55 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44r3L04hd1z9v1v9; Fri, 26 Apr 2019 07:59:52 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=cj/deBlo; 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 veHtSfkS-UAy; Fri, 26 Apr 2019 07:59:52 +0200 (CEST) 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 44r3L03bkGz9v1tj; Fri, 26 Apr 2019 07:59:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556258392; bh=CdZAWtK1Toi2PIHVI6vPbGzH/nxkdPNYtkmYkbl6Eek=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=cj/deBlou+TS35OShgq1bIZF7x5XvaA1D67umcaIq9Olpj0LmxhaH46DZc8feuyMh lIyKiKF5JipY5IrfzBBLjjWRMri+I+Qvdv3bPVpwuhYw8afS2aDvrfY8D80dkmN61b rNibzcAyyJCv4P0Zwz+NCkA19kQqQ+wJusuyvUNs= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5B0DB8B807; Fri, 26 Apr 2019 07:59:53 +0200 (CEST) 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 JTTYIuQUBg2Y; Fri, 26 Apr 2019 07:59:53 +0200 (CEST) Received: from po16846vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.6]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 363868B74C; Fri, 26 Apr 2019 07:59:53 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 129A066276; Fri, 26 Apr 2019 05:59:53 +0000 (UTC) Message-Id: <1a5d0621f9c6e842497050d42a5e279a2efa0efc.1556258135.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 17/17] 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: Fri, 26 Apr 2019 05:59:53 +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