From patchwork Thu Dec 7 13:10:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuntao Wang X-Patchwork-Id: 13483269 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 A1E40C4167B for ; Thu, 7 Dec 2023 13:10:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EA036B0080; Thu, 7 Dec 2023 08:10:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 373BD6B0081; Thu, 7 Dec 2023 08:10:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21ECF6B0083; Thu, 7 Dec 2023 08:10:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0DC446B0080 for ; Thu, 7 Dec 2023 08:10:50 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BE1F7401F3 for ; Thu, 7 Dec 2023 13:10:49 +0000 (UTC) X-FDA: 81540057018.15.743FE75 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf17.hostedemail.com (Postfix) with ESMTP id 0480E4000B for ; Thu, 7 Dec 2023 13:10:47 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=H3AvrIj0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of ytcoode@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=ytcoode@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701954648; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Zhkw2Q2fxvLpVCfPy6TQyBx3BzZfQXBxqcbsZhqAxCU=; b=EfXrXVf8O6hJEkFJTT4NvQg/zPjlHrCa5IvDC6IrSwwABEjqbyXah8NPKnFEVOwweWY//o X8PxDqLwUdwJO3Z8tKYBFChYFxFsMt9jze7VDBdy1hVBVqL5T7aBM2MzxVgB1o1PyKgDCl +WL+iK/Cv7qkQclircn4nMzq1xxBlxo= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=H3AvrIj0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of ytcoode@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=ytcoode@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701954648; a=rsa-sha256; cv=none; b=YuoaexnYePydDe4+KBN26L8smjxXYn1n1f8g2gF5TzSRlxb4WnWU+ux6W3HfhO0/jDGobY rJHrc8WTyM3ugW6NTeoJMoc1ryA9iA0g+WNTbgHPMnV++XzhmgOY44BxM5DXt7GyOXcsZF AGyentJ3H4pVXM+ikWVEJM4nQUaGo3s= Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6ce72faf1e8so491967b3a.0 for ; Thu, 07 Dec 2023 05:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701954647; x=1702559447; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zhkw2Q2fxvLpVCfPy6TQyBx3BzZfQXBxqcbsZhqAxCU=; b=H3AvrIj0fGrjGH6vxSyM/46Mzku0T2PXmu9K3aQawqThJnrhC80XFByRs5b10X8ZNY bnbM/VvAJWJvaDtf/7VQtADahUvk7VqXNvlZNp/+nEzvNU/bNI0uJz69c5I1h6dvbvE8 OMISzcqcHTFsNvJu0KOgaSD/05N62pAU8oBMBVeZ2kN4Z2Kx3nBlGW5+mZ3lP1me9Jm5 a5bYU4R8Apj74ZWC6Gl4bG5AUiJeeRESdnH6kdR3G3B9FTSrTswX8Z0S1cebNA5CsAd7 Z52pdMI7KYW/Eb68ZiEZi0T/h5HfTG2EsYXYdHZZw+IlSP+MDLoru8cl0o5OAEUmvx7m 20oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701954647; x=1702559447; 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=Zhkw2Q2fxvLpVCfPy6TQyBx3BzZfQXBxqcbsZhqAxCU=; b=u4vbW/SP8DmjZqpR0Hqcl//451usdrMLEW2i4GYSzyBN4kYEY0WxVVSeqTwYiOM5qz gv4LDyFmg2sp2zQmtVAUCgFbmr1TgmLn82/ZqkPzPMqjfIL+urft2/LvnJ3Api/WrbPu MeMx/jZHjhl4Zd3DdlGvLXT8krAxO4FU7+lARHVJeOFb5sweHCUB46qLaihozzzVDNvR Vp67cK2cw3rtbtQEa/bRLt85tnS7cWegPebym61bDgvGFU0Kwjz02Yxx3iFFCcurp17K aCUdW1FKQOKps7VdpPrWo1p8vugXC3F46Fc55ygj3Ohk0bGTL4+6OX5Fdp94j+q6/BYr oVag== X-Gm-Message-State: AOJu0Yz1b1rOCGQHmYBRekrEhtUBB3qrXe8rPpnmB/DwLkxF5Wy24k+7 Q3f4e4mPe7pKzkfNCaPBTs0= X-Google-Smtp-Source: AGHT+IFab04mQkrGt5aKvlslYUXNGB4g5Ira/IEnpoOq5pw8jwKQw0PXwZEQJ4YaFZqUq8fZo6rNAA== X-Received: by 2002:a05:6a20:12c8:b0:18f:97c:8248 with SMTP id v8-20020a056a2012c800b0018f097c8248mr2300799pzg.82.1701954646690; Thu, 07 Dec 2023 05:10:46 -0800 (PST) Received: from code.. ([144.202.108.46]) by smtp.gmail.com with ESMTPSA id n1-20020aa78a41000000b006c320b9897fsm1229036pfa.126.2023.12.07.05.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 05:10:46 -0800 (PST) From: Yuntao Wang To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Mike Rapoport , Andrew Morton , Yuntao Wang Subject: [PATCH] memblock: Return NUMA_NO_NODE instead of -1 to improve code readability Date: Thu, 7 Dec 2023 21:10:01 +0800 Message-ID: <20231207131001.224914-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0480E4000B X-Stat-Signature: 65s31yr5e3zrdy7y4dimq3z4cqdhw5uf X-Rspam-User: X-HE-Tag: 1701954647-11862 X-HE-Meta: U2FsdGVkX1+5Imiazp0xzm98nSYxY3G9xbuKIlnNNurK0tIAGKZ3u6z0/nNaxG6a1KVfQDIZg/4hpoRbak45Ru4sroutV6a9ghtTYWhA7OZ6JH7eDR9u5tVBr2MAlyRx48iEIFk0YoXfCwrDfZJ/lU2b3JkXP8w9jiEvifqL8wSxN2Pin6ZyWOGx7Z9vXZvp7ys+hu5Qw1dKeWfvzX/mmKdlbpuNWAon7ZTdzIMan4Yg+xXcIaE9s3U/JY+PitPEUEby+YCoBg6ssu+lM/X7ixAxzhE/okWjrsRJyqGRPVCbc8rSRMMHkSDyRAO22zb6EGgMLM9XEVb7CiDD4lJ6154SM87TCFGcY9LwVYgohHfiG5v9HzM0QPau/uK3+TiRRRinX5QV0H8ec8bcL9aZA6WblXkw45kpJjKCKXvu8bHAD/49JjdNDR1juqDpcCoKghte2RdlDk2Lu6NBGqzqZJJkJ7knlcnOLL5xufPj5SoMAzR8o7WiCiQE2OKvz40ep4z/iPQLji4LkEhN5yXhsnD9WZ5Y04ZpUhL9eQKK8Ay+YtbILeW/4tMgv1vUVolQz1xV1YxZbZ6K1Or5dcLfslMC4Y7fXSqO7FBWi0Bu+Rzm9/EHerJU4zYXmWskyDf9S82u9KaXRrPhYYZ9qhoqX6s4LwINjVJeBd97M1/bEWu4OQaEXITx0QD0+xS/d4LXyTAdnIsVQFNBbiK1snlBcHnAvG0VUk8kBSO9KJN5zWPi98odSKCXO8umZqhGsdGPvnsa2p3aKxtr3dlFxauUIQDE7PVs5jhG7BbgBQpN0xQWsXyQDCHPvpY5mQ2WxSIgB6eSs5NhciGKbU8f0Vh0UwL4ZriWcbgCjoTtuRPhg93pmjC3l7qnNt8SlUF8TqfDWxpMPDbYv4aG9gNyo90qFEKU6tqRT0EZ/cCcUjjESH3pD8KdO22ZOzCFOXtcWPYu4anM3Mb5rpwyDG6i3vi QjtVMTtF RJu8MktSmaUh4Ax5V55RPdCVCo4aZBW+X9fec36fXI4r6010K4SnnP+iT7oXsRJl4ENGVdBCXLSezHPnUPjXX9IFERv9Jo2QnHSO6QasNWo+fcvkFM3Fi6GaXF90V7LQWyWjxPpDgYjF3uf7T16Vn6h9pbd7feHgNkUYMIBPgLWSIwJu2rwWX49Kih7INELbH58IF8ThTZCY7yvgv3hU46/rbSwJOpGMpxZHTE8ij2mTsk8l5UdXU3UcBQnbGf9abDVQyp7V7TTdte15Ti4fBdRVSqYynj9sSz3okotE6J/mEyZA3f0iwRmQ4562sz+8iqicxTF/lv/beOqlqCpOOFEXg8vpctdXpZjQXAjb2UowD/zYJI8BR0dVVLz48xM0RK8HjByARXJZ+iR1ga9aVPDIksv2PwUiVrVbqsklH3gifnoWePx7BMaATsQKnbo6u3zbY3l/cK/XLFp9NZtGGZolb27IN2pTH1PyFaQZ+SKIdnF0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000661, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When no corresponding memory region is found for the given pfn, return NUMA_NO_NODE instead of -1. This improves code readability and aligns with the existing logic of the memblock_search_pfn_nid() function's user. Signed-off-by: Yuntao Wang --- mm/memblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 5a88d6d24d79..c1f579c23396 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1851,7 +1851,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn, int mid = memblock_search(type, PFN_PHYS(pfn)); if (mid == -1) - return -1; + return NUMA_NO_NODE; *start_pfn = PFN_DOWN(type->regions[mid].base); *end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size);