Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp269430yba; Thu, 25 Apr 2019 23:01:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqx99/Dw3ovxjde9Oiln72HzwMTlUlagh4iLrLq30Q2NrIlT/62usA3qEY/DLkUcnSrRyDSM X-Received: by 2002:a17:902:e684:: with SMTP id cn4mr43301396plb.71.1556258467564; Thu, 25 Apr 2019 23:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556258467; cv=none; d=google.com; s=arc-20160816; b=dRGn2MkvZmxG7b+jIEMFqAFCwYfrRxUr0zKhDyW17xLZU4J4RR6jBUFIIv/V89zP7r SfznpniJ4LT7hh4c6GgLhyI3t6aXjHnekAQzCBkig1LRb+medXSx5FXzcz3Kje0mrTg8 jzThgOxCGVq8JmZGvza8+5vXo5gedDEnfXIWk02RgGkAJxKld4aPlSrfgHqi3qXYj5Mp cWjjDDK3rU53JFInpCZW3Qq1AONhl15pR0mgD8KpQp4GbTNo7lQoiHtiQGeNeP9xgsXT MSmAsIousiHGDWjTd0t3GYRDuJcqhgC4UkgiAM4UpeaZxqZrF5XV53bU3GRH7M+YGeEN 1Zaw== 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=LABEz5CELYl4E52Ujra4A1k76PjcKmhHsEgVralrDnb6FGYhmd2EbvpSxpcu/Ctai3 DPVE9d6gnsBDGvLiGEp4mVX+KrarNknvtjOpJMFojLgasqGOCYeSCH1HwgUX3P+d9l/4 eOh23DwcOissJDfu/zVtXvfRRaGhwZIeIsudylx97kPddHHjrJluWkLRXnNlHoe2QNxp XWNuOELh238ziVjqX0ejNRf0abob+6V/PWiYnuwMYG9qHf6TJMWle2Mtu9q2+wgkkr7l UGTGaoO7rtNDMZ6+Pyo+lavLQm9YTZ5A8TLLCJ277NRXFuukur53A0/cYjkF+tquO3yp /nuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=u3ZWvJcv; 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 k14si23359424pll.126.2019.04.25.23.00.52; Thu, 25 Apr 2019 23:01:07 -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=u3ZWvJcv; 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 S1727139AbfDZF7y (ORCPT + 99 others); Fri, 26 Apr 2019 01:59:54 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:4713 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbfDZF7y (ORCPT ); Fri, 26 Apr 2019 01:59:54 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44r3Kz3yByz9v1vT; Fri, 26 Apr 2019 07:59:51 +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=u3ZWvJcv; 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 1eTNAcPJdeIu; Fri, 26 Apr 2019 07:59:51 +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 44r3Kz2hZpz9v1tj; Fri, 26 Apr 2019 07:59:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556258391; bh=6CbrzkRb9RKVUNX5pyD8e/XjgXIgb01llI2Zcr1ERKw=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=u3ZWvJcv37/VkU0yMfxSyyQHhGLG/zAcpee88kdokAjyW0dSkYjmQP+7dIA1adkG2 B4EBmuOhIBpSTU/u913v/o/14ZZmdmyXQgbkqs0EkNVamte0K+x22ysu3LvXqO3X7H pjEgZ0mwzvKapOgQB818Sgi+XFPXWX7b6FE6LjVs= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4864A8B807; Fri, 26 Apr 2019 07:59:52 +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 5hOiM4u1OHi2; Fri, 26 Apr 2019 07:59:52 +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 2F8858B74C; Fri, 26 Apr 2019 07:59:52 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 0AD6E66276; Fri, 26 Apr 2019 05:59:52 +0000 (UTC) Message-Id: <52555dbf9b237ac904c8c4c6b7c09c823c867a7b.1556258135.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 16/17] 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: Fri, 26 Apr 2019 05:59:52 +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