Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp565802ybe; Wed, 18 Sep 2019 23:35:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCNSo41vrADG8Vi7gQigx1OS4CDVlghv75DxUtY7WpbXZ6HwNWmL6SXEDsDo0YxUnEC/QB X-Received: by 2002:a17:906:1998:: with SMTP id g24mr2713275ejd.305.1568874906582; Wed, 18 Sep 2019 23:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568874906; cv=none; d=google.com; s=arc-20160816; b=qSjD+xEb/htYSd4UEtqx3xmNdewwkH01OG/GPP8K5/FoocyeVhpaSTSSvK7QF/USGV Yo1Yen12+HT6bZQZdzLt82aq1oTnIN0XXzs4PK+RdAnRdW1LYWUtT794ZEL3F6NlvIYo p3OVP0N9+XUJNCXHcnrKHThgI3q1F/JfnMavmX3f0PI48wAtZipqI1zW88Img8EdwZ+o d5Q0NAru3qXjJ3pKqT73mNUr9ARIZv0lI9m/v00Wj3/BFa441kNAs3oTofpBN/Ocx6KD H0D5xg/AMDHYgMb/QK0HO+B6eYcu/5Jwy/jJahJo0P4o8TBk1509aa0Zp8Obe+JpKu/K Q5qA== 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; bh=DjUChK2rp3UQ23rFbkHdeQ7CYHNVf3lGf3XiB/ZYLvk=; b=y+cL7PNFpDS2qvQ0fcc1PR3uY8su/G0mS2McfkyqlTbWevOhjdPNj+JF20Wej8xkzT c1bnVCjDgBYdLbk90UhUF+DEZdd4/GQZyrehtldrmnoJ8rWFWAujWkT31kveNW2hfmQj 5B5s9KJub6r5vHA9Mp++14L8WhqSpcZSBi3ffansCcqu43HrCHxU81DKrbYcu+Tz8jB3 SUmCW7xgPqfIiHJe+fU1kJV6CzjSj0ZV8BEIjkXGfRX3KnnXXXRzyvZs76OElPzcELfm CBeRnwDdJbzhzqvcyoNFN4Nvx17yZzkugk5xDPHUsA3Af56trwVqgzwlLaFNThXPD1te tU/w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j38si4750886ede.374.2019.09.18.23.34.13; Wed, 18 Sep 2019 23:35:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387750AbfISCJU (ORCPT + 99 others); Wed, 18 Sep 2019 22:09:20 -0400 Received: from mga02.intel.com ([134.134.136.20]:4977 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726812AbfISCJT (ORCPT ); Wed, 18 Sep 2019 22:09:19 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 19:09:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="387108079" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga005.fm.intel.com with ESMTP; 18 Sep 2019 19:09:16 -0700 From: Wei Yang To: dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 2/2] x86/mm: replace a goto by merging two if clause Date: Thu, 19 Sep 2019 10:08:44 +0800 Message-Id: <20190919020844.27461-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190919020844.27461-1-richardw.yang@linux.intel.com> References: <20190919020844.27461-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is only one place to use good_area jump, which could be reduced by merging the following two if clause. Signed-off-by: Wei Yang --- arch/x86/mm/fault.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 9d18b73b5f77..72ce6c69e195 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -1390,18 +1390,17 @@ void do_user_addr_fault(struct pt_regs *regs, vma = find_vma(mm, address); if (unlikely(!vma)) goto bad_area; - if (likely(vma->vm_start <= address)) - goto good_area; - if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) - goto bad_area; - if (unlikely(expand_stack(vma, address))) + if (likely(vma->vm_start <= address)) { + /* good area, do nothing */ + } else if (unlikely(!(vma->vm_flags & VM_GROWSDOWN)) || + unlikely(expand_stack(vma, address))) { goto bad_area; + } /* * Ok, we have a good vm_area for this memory access, so * we can handle it.. */ -good_area: if (unlikely(access_error(hw_error_code, vma))) { bad_area_access_error(regs, hw_error_code, address, vma); return; -- 2.17.1