From patchwork Sun Apr 14 00:45:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13628864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEF2BC4345F for ; Sun, 14 Apr 2024 00:46:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 442316B008A; Sat, 13 Apr 2024 20:46:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CBDD6B0092; Sat, 13 Apr 2024 20:46:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A8F66B0093; Sat, 13 Apr 2024 20:46:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E3FBE6B008A for ; Sat, 13 Apr 2024 20:46:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B0F14A01E1 for ; Sun, 14 Apr 2024 00:46:09 +0000 (UTC) X-FDA: 82006295658.29.8A2F2F2 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by imf09.hostedemail.com (Postfix) with ESMTP id EC5AE14000E for ; Sun, 14 Apr 2024 00:46:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="VOw0n4M/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.181 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713055568; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=w/dvtf5OnUdjQidRgA75fz8JoBIkn3GX6IPfWGFBXt8=; b=i2lD3HpeE/J/ZuXC0K1LetIOYdHECptgpruYK9TDRtQg7dfTPxccVwga+mGDnYBw9jRtV8 ce8MH5ctijOv4ke0msOsZSgYTXPrYqHVcfHWeMSZRL00P8R/StCHgiOt1re3cgBBxC+IA4 VgzWB5G7v4766uPKxFpoIRkRZnkuHQI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="VOw0n4M/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.181 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713055568; a=rsa-sha256; cv=none; b=IAHYLWCN+PgNl7BfirR4/tYjQWlIA+uMT55iWI2UnLq9bx7OPcg6na7731dyS61NLccTGJ ZzdlLUoyk7ctA5Diu4VgrIF0RT47ppSVHwEBdGWcSb7FjnDnlp0pxcqiYhRZCscebfrPYb +4kgW4il3bgy9zh9xeu/0aec3+lWXWU= Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d895e2c6efso26015441fa.0 for ; Sat, 13 Apr 2024 17:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713055566; x=1713660366; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=w/dvtf5OnUdjQidRgA75fz8JoBIkn3GX6IPfWGFBXt8=; b=VOw0n4M/RlhzuMtGqoRg8FZCUqRV3gBB8h62eoppPij2zUsP0bBZwzvyKtnf3fJHe+ yQh+q6RFBx9fiRS5olR7UBDXwHHIG/Y1uNbCLLrSBy1J46fUysuMgb03MSuzpIan+BFP 02rJ1+1qbnCDdFWw/ulfCnkwkDS4CzRSS0DV4k3IlhAIXzZZsN0b2zkv9/Yo+XKzlxWR c9w3bFamua2ny/kBJiuA+1wJu2BhcRLlptNUQCX2kBU1LeUv0fUKQYEPuzApZH6ZNeYT 3MhWMUBLgUSJGGOygFRqB9e92mjdR+vXNC06BzpI3v2akZwy8iyo5cIsG/qkKy0gKrdz sxtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713055566; x=1713660366; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=w/dvtf5OnUdjQidRgA75fz8JoBIkn3GX6IPfWGFBXt8=; b=rvS33iCaxVnf1xABMV/1PPcKqxkuHhqvWYcCOIiQrR1U2rAAOMJR0L6tLj5wwdeheP 7jT29Bwd4+yMDnHEercLTypHVriklML0Q0+8uPf1rs2MNyqFggXz42I4WPpIilvD40n0 7wXrSnPAruIfhMyJEe3wNNhxzS9D4PQaVfOQjYgaQ+4i3ijhR5n8goTxDDairM9Tl5I7 CNySyPLLIR+xMHZhgVFOGe/TAaqhvLpAPdr6ciMwuyU1J+fT0yJG1okPm1uKoIREC6C/ wb1lbyZiA3LNM2VPzWRS2ygGHJGTrjYI7u/i+Og352nYXxNy8Vdznddf/o+G9VuWsPVp w0WA== X-Gm-Message-State: AOJu0YzN6TsykhxAEbOsPkmPRqlNKx9p5Rrk9Jsz2b63NR6CHPMuV0H6 XQcPgq5RFrP9t8LDXDJUtBdQ0XBrxBaTgLRI4IDaAdKua98dmZx8 X-Google-Smtp-Source: AGHT+IF8r4PaSqCdZEsz5ZQikXIGPm2x4/7yXMdnCDUjHGr9cWvEYc0lHYJDJqnG7YjuSBEf5aPKlg== X-Received: by 2002:a2e:9ada:0:b0:2d8:6a04:6ac4 with SMTP id p26-20020a2e9ada000000b002d86a046ac4mr4010246ljj.28.1713055566106; Sat, 13 Apr 2024 17:46:06 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id q26-20020a056402041a00b0056e78224d82sm3077837edv.81.2024.04.13.17.46.04 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Apr 2024 17:46:05 -0700 (PDT) From: Wei Yang To: rppt@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH 6/6] mm/memblock: return true directly on finding overlap region Date: Sun, 14 Apr 2024 00:45:31 +0000 Message-Id: <20240414004531.6601-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240414004531.6601-1-richard.weiyang@gmail.com> References: <20240414004531.6601-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: EC5AE14000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: o369wm8rcfwjtk1cg4mxjowypqajz7hm X-HE-Tag: 1713055567-888667 X-HE-Meta: U2FsdGVkX1+aMWRAX7NvPuQb8r/jzBhWfmTzHKL9pvR1O85aYH3APo1sc57z0Anw6j4B7ojjzQnacgeV6roGyFZJjbsnmvFOMzuU8YByTEUBKSCASUhv7tljhqYXBt2/lrMZDSIKfZ1ykw+Kpe+mjyUoN2ImUH7P5zEAyYPcJBIXENFeA1DgR/DtsgIig063Z/DurH2C4dULrkz/Lnk3Ii94z6TM/ECKbsrQ2gvcVqA2CwWQqHXeQlXnKy/OGd2MSZgbEzwpky4Z37dzk7Cp+lSJqVO9vaX6wGKBMsiXRyTJNEs8g8sFQbcC29rRGHoaQDxhNtj8t682kk03LA7XSJkUt3qYCHAv+W7MLdXjP6ut+rzLSOWl99smXZ2RVCd4C5HKDd2XAyG/eLyRjjyOnXhhBP04UMMkij+HaBLTFHK4XxR3MW2TbQq91uI0ykh2AcIQb3fAzSzhr4DhhUpzanm/8aMgN994XLbsblLFcUxCrNpF64C+COuSLNkrEc7fXqfQ/H6O05511RH+lDYz7xe3NDp7rdn+CONPsz0NxHAVjTlaIudrOlXjqQaRhJeZBGJm8AlerCPZ0hdWgAezugS5B4BVsY2y2hbgH6Qau5zPssO2RiDoloxl/SOfN3P3Ez7rVtxwIQOIREzQg4Go4/VDQewRVudBNtg9Rm+NFlwn6WtlvPYetnE/DldldNfMdCI+2jM74b0KYdOutS1QmyCu1BoRP2EWNmIXyIkuQT3tpEIuHTNMiKCgDAcw7gsEYHaVjdl4VXGXbYKh6zXVKbaQHRl6sJwHYQSgukHfs45p5VqRGYlh8T8nS4fxpqwRjrycRp/iFVpWomJnFXKPVbuULEO0zAhxB/pxyJ4nM4EJKgcLOX4XrbzA6l8D3pZrLRE6ibfR/h2HvS1h7xGAwIvhFXS+2bLVPIctHMvJyhAPSUxBu3wxr+bqd6Cw8RnuZPjqBFFHSPyWriXauU/ NQ+TXj5B W+e1hWSjpJUbYCXeDBzXzoWqcuXDnah+UoqEnupok0d7cvpvV+TF0wYDdilxDm9vNV9Zy9gkq4bivuh9ot74Y/QS/TSXras6QA1pasIPf21heaM/95D/Vu7bHMunAL7wHrlxvOygTsvV7p8bSFhOacgchOjri34I4CZXgkHebamFTHty0+tB7vFLF1b20DgsRMNJwSibeFwvEhdbRbeIXObN7/rax80R45pIG7CI38WuHFB7AUBbCPJERTJ4htHiMcW+iK5Hi7eNGZ+TE5QMttZodcT3f4NuH39wRt+mbB+AN6fa1M6lSGCEm0NrdjsRdXVYTNMo1MozVPGj9trXI+J9RnPzJ/y2mUypnhFCji3NwfKp1JVsneqDJQD0YB1xzJlSLxkXMB2VArwklZ6tw/MtIM4Ln4om2OThVidTQHZZwR/o4nqjwv3kOsGPTortVU9gOKsTwrePPauXZ5XxwadmTgoy+iBxngLrG3EEwtQcmg+qBJ3tB+r74J4f9KeNkIYgM X-Bogosity: Ham, tests=bogofilter, spamicity=0.006012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Not necessary to break and check i against type->cnt again. Signed-off-by: Wei Yang --- mm/memblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 3fecee4bd41a..77719126208a 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -194,8 +194,8 @@ bool __init_memblock memblock_overlaps_region(struct memblock_type *type, for (i = 0; i < type->cnt; i++) if (memblock_addrs_overlap(base, size, type->regions[i].base, type->regions[i].size)) - break; - return i < type->cnt; + return true; + return false; } /**