linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Junhua Huang <junhuahuangdream@163.com>
To: dennis@kernel.org, tj@kernel.org, cl@linux.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Junhua Huang <huang.junhua@zte.com.cn>
Subject: [PATCH] percpu: remove the unnecessary operation for bitmaps in finding suitable region
Date: Sat, 14 Aug 2021 20:20:18 -0700	[thread overview]
Message-ID: <20210815032018.192334-1-junhuahuangdream@163.com> (raw)

From: Junhua Huang <huang.junhua@zte.com.cn>

We use pcpu_next_fit_region to find the next fit region for alloc. Once
return, the region fit the request and then break the loop, or get the
next start offset from pcpu_is_populated. So there is no necessary to
add bits to bit_off. At the same time, bits will set 0 in 
pcpu_next_fit_region each time, so I think it is unnecessary to 
set bits zero in pcpu_for_each_fit_region loops.

Signed-off-by: Junhua Huang <huang.junhua@zte.com.cn>
---
 mm/percpu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 7f2e0151c4e2..ec7a5d10f6c9 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -489,7 +489,6 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits,
 	for (pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \
 				  &(bits));				      \
 	     (bit_off) < pcpu_chunk_map_bits((chunk));			      \
-	     (bit_off) += (bits),					      \
 	     pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \
 				  &(bits)))
 
@@ -1126,7 +1125,6 @@ static int pcpu_find_block_fit(struct pcpu_chunk *chunk, int alloc_bits,
 			break;
 
 		bit_off = next_off;
-		bits = 0;
 	}
 
 	if (bit_off == pcpu_chunk_map_bits(chunk))
-- 
2.25.1




             reply	other threads:[~2021-08-15  3:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15  3:20 Junhua Huang [this message]
2021-08-15 16:19 ` Dennis Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210815032018.192334-1-junhuahuangdream@163.com \
    --to=junhuahuangdream@163.com \
    --cc=cl@linux.com \
    --cc=dennis@kernel.org \
    --cc=huang.junhua@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox