Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp402208img; Wed, 20 Mar 2019 03:08:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqylVssKvlZz+K2skJhK4cul6aT+WkuS34E9NeSwL5OfLypgBpiLsCF3QOrVMqIwdHR59wQt X-Received: by 2002:a65:4181:: with SMTP id a1mr6625471pgq.100.1553076503235; Wed, 20 Mar 2019 03:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553076503; cv=none; d=google.com; s=arc-20160816; b=fZ71lmHgFrD/os/99U05Sl0wNiyNViagTLnGHASfS1M5HrtzTMWs+iRtPqPa0amf81 z6dn6oFc3n2cLI7nV1pDyNCvQB0oi02w7ejBJxqCtemm6h2R5aTO2WmBw0Yj+y6iDVp6 QdM7zJ6sCmnb1IIAwxsIGUjJZ2OaBhJPMUkyQGuTWf1TRTM7tN+BWLo0sVB0QkvnVEVs f8w8wHwDWVYwE0cYluOx4L58rHeGFp+h0UB3/sBj91GFkqK+ZVDvmEjS+Bi+tu/JeRf1 gpJaBhHPSEf6sDXynKYiz0El5esRsYs/IvEOdkbZTa3v1MEo+pZgmfBBTWolLSysTiis rhVg== 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=6CbrzkRb9RKVUNX5pyD8e/XjgXIgb01llI2Zcr1ERKw=; b=H7B166Q8JXh1FSYG/Sogn1cAdwopDJC81rJL71tnrrYgMDI6VjRVqiCqqh6csB/fS9 bpxTBpyD8I64+lZ+Ahqu40N6aGQR8TqdCe5gT/Ai2tWK8tlwLwvFvS49iwxIw+IzshRG S3IJJjHo77CN5PJwSh3v/gLQnlXImEDevKtkWydJyv5OZe3Ca2vJqXhHMr1N6WNzk2lx Sb+tBHwvWSvwCcn6BKYNAdNFcFfinqPdLCRTtx8IXzQkrjJzr6X3kKtMIoETLOLAmy+i 443GhresL5+oqQA0PrJrR6W2zJtmmgyrECdMAw+9yFzlHRdRnai7q9dakKYd0zNGGY8N p9iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=jYxTWKD7; 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 f127si1286994pgc.505.2019.03.20.03.08.07; Wed, 20 Mar 2019 03:08:23 -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=jYxTWKD7; 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 S1727943AbfCTKHH (ORCPT + 99 others); Wed, 20 Mar 2019 06:07:07 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:43859 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727907AbfCTKHE (ORCPT ); Wed, 20 Mar 2019 06:07:04 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44PQZG2hfSz9vC04; Wed, 20 Mar 2019 11:07:02 +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=jYxTWKD7; 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 63wZHQNEYNAK; Wed, 20 Mar 2019 11:07:02 +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 44PQZG1TdTz9vByx; Wed, 20 Mar 2019 11:07:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1553076422; bh=6CbrzkRb9RKVUNX5pyD8e/XjgXIgb01llI2Zcr1ERKw=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=jYxTWKD7pD3jEAo+j/otV041zvFVJZg08BDmPsPqOfq7YVKbQHfrn/UxFTHF+EejV 2617HtmWxo+mB7wJmedfaIemb9udcoeNWgeSrznSFEFsOMIvIA0VVQ//9ooJzG8FL1 OOQAbjaR3fNW34sylfL/Mw/aGWSjK9PewHo75okg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3C72F8B918; Wed, 20 Mar 2019 11:07:03 +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 r9in0AvqDJEH; Wed, 20 Mar 2019 11:07:03 +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 2271B8B911; Wed, 20 Mar 2019 11:07:03 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id E18DC63AEF; Wed, 20 Mar 2019 10:07:02 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 26/27] powerpc/mm: flatten function __find_linux_pte() step 2 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:02 +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 patch left { } blocks. This patch removes the first one by shifting its content to the left. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/pgtable.c | 62 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index d332abeedf0a..c1c6d0b79baa 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -369,39 +369,37 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea, 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); + 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) -- 2.13.3