Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp110662rdb; Wed, 1 Nov 2023 19:37:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGV1Sm5tI5lJ6UfIrftdK0UdtNg45p0dM8L7lhcLcIqT9mkljlMUeQqwdJE5upuW8MA82pV X-Received: by 2002:a05:6a20:6a07:b0:15d:4cf1:212e with SMTP id p7-20020a056a206a0700b0015d4cf1212emr5359444pzk.4.1698892653640; Wed, 01 Nov 2023 19:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698892653; cv=none; d=google.com; s=arc-20160816; b=BDwnL8D2mAPNtf6S2f0erdfzKUweLzvOhdzjKFe4WTyvDcU2qPhboUw8WUKGPuKTTM OGs5t3nx8HdVt1VgijyKGutbH71lZcFogSlwIG4kjf0K6XDS27ic79PE9m/Cop30tGNv 6LqRcM7NhHguvuNTYcvghyIJWA2oaQ9uRs6p0J8gAcYO8Oa/aI+ghD9rLeGD0Gli/DEy 4ZgD1EHGnDp9kjX88XIUm1MHYkgJ7W8o8iafrT0brpbXC5b1cG9+uo6T7bLu+LxPI7JU ZnIdHeLykKV+V5jirEtK+qclFQK9jIcKBJCInDXYuKeHhl8cQ3BChFj3stqxlXsp1nJU APXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UKopUlcYKHiL2msqII7e4sEdoZVJ2JhDrM+KqYar1FE=; fh=ky32JbNoRHD2DRZKXOz5fuwHbvN1ooj4AYblYZtRbKs=; b=JZbw+MXAyMLbMrd5cSnSCnZmVUSeWUL5LVLh7fPKhXeuGfddD8HylQHravz+TawpcZ /hUNQvTDjxZSHN9XTlHESoBBt8sPUMHqDKhxBswSDUHKBvG4jHFc+OHynftlOlqSyaGI M8vTt7sJskcihVgwWWA6N8a3arfYh9IA1Cx2aeq6LnJq2UC8m6oomFB+eANPjS42wdTS JFQ1l0QKsAOPApbUCn4Or7C2uafcSi9QI9CbsrRKmmOT0It9N+qawbj6szo6jPg3Bulu 2QXFFbt9iiH0cluUNIvig1ZdgyZ3XCTz/ceGqmwP8/nzQjF/H8ub4mKWPKGng3qd01wn UFPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U8OxLhL+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id i126-20020a639d84000000b005b942de1e92si1031525pgd.443.2023.11.01.19.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 19:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=U8OxLhL+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6039C80C8DD9; Wed, 1 Nov 2023 19:37:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348267AbjKBChW (ORCPT + 99 others); Wed, 1 Nov 2023 22:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348035AbjKBChV (ORCPT ); Wed, 1 Nov 2023 22:37:21 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E468F101 for ; Wed, 1 Nov 2023 19:37:18 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cc53d0030fso4184235ad.0 for ; Wed, 01 Nov 2023 19:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698892638; x=1699497438; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UKopUlcYKHiL2msqII7e4sEdoZVJ2JhDrM+KqYar1FE=; b=U8OxLhL+B4iZa85OamlTGXnzgLW11pNz/Yz/tzvZ3XIo3Or8RxkoFsEsw/HaeLp3x7 J8SwHRfNd6M6PznFVmKzAvny8PRCbEWIohZB1dTJpu5mqBCVrycyxY4JX14tgjXKRph2 BDu8+tG/98vRVPLhuTZhApqAMsO2q2slJY4CDFlrfe+mi/97xWWOAh543KsO6pOtVIYH LLcQc79nIq5CTAI0U/KvoKVtPEeMRg1Bs6hH0K2pIKsN0/BQYQJikvGqntxjEwMLCVZP fyXxZ4pdIJWZEtgLmqd5XIFrox9dutMqct+4HzCLPLV4xZ6G2G5jVSMNLyIeOZuyK6kx iArg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698892638; x=1699497438; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UKopUlcYKHiL2msqII7e4sEdoZVJ2JhDrM+KqYar1FE=; b=kDTLb69c4NXbACQy66R7bIZF8yb8SiF+h6sJTMXFKCUO6tqhbX+ePjudRXY//O5HTz l573XEZDP6av3CtexIEv5c3MIVJVXoVUhdPEFXif7+NDOXlTWMvM7IXkb2r0nA4JPmYe G8e51N6Z+Uprs9CH6zSRDTOkq4f8Oc5ksP9LVPnXTcH4fPjDGrt2DV1E9Ufg6hCUjRNX P3wIUkaWvs2rvWVXbfrLO1f4Lgw+FihtL2Z0cX+1w1fdbHHxK1TPQmh7WCk3IbGmqDBm mPislbSjWTEepeEulXeyLzG7YMqtSSOMd7Di2fO3WToKhz36KZkrjkSn5sVUnpAKi8M1 75Yw== X-Gm-Message-State: AOJu0YyDtGsbbOQ/I24lsvy0t4NYzWU2+VZGJ559hOicAawu5Pcr8/pL Wrf173ZBRknGNjTIfQuQZCw= X-Received: by 2002:a17:902:d488:b0:1cc:5f5a:5d3 with SMTP id c8-20020a170902d48800b001cc5f5a05d3mr10834928plg.22.1698892638198; Wed, 01 Nov 2023 19:37:18 -0700 (PDT) Received: from localhost.localdomain (mail.lemote.com. [222.92.8.138]) by smtp.gmail.com with ESMTPSA id 2-20020a170902c14200b001bb892a7a67sm1923156plj.1.2023.11.01.19.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 19:37:17 -0700 (PDT) From: huanglllzu@gmail.com To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, rppt@kernel.org, Liangliang Huang , Liangliang Huang Subject: [PATCH] mm/memblock.c: using judgment statement can reduce loop and enhance readability. Date: Thu, 2 Nov 2023 10:37:10 +0800 Message-Id: <20231102023710.13023-1-huanglllzu@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 01 Nov 2023 19:37:30 -0700 (PDT) From: Liangliang Huang Signed-off-by: Liangliang Huang --- mm/memblock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 913b2520a9a0..e48dea7144bb 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -655,7 +655,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, } } /* area below @rend is dealt with, forget about it */ - base = min(rend, end); + if (end < rend) { + base = end; + break; + } else + base = rend; } /* insert the remaining portion */ -- 2.25.1