Skip to content

Commit

Permalink
mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated()
Browse files Browse the repository at this point in the history
To replace list_empty()/list_first_entry() pair to simplify code.

Signed-off-by: Baoquan He <[email protected]>
Acked-by: Dennis Zhou <[email protected]>
Signed-off-by: Dennis Zhou <[email protected]>
  • Loading branch information
Baoquan He authored and dennisszhou committed Nov 8, 2022
1 parent 5a7d596 commit c1f6688
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void)
* other accessor is the free path which only returns area back to the
* allocator not touching the populated bitmap.
*/
while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) {
chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot],
struct pcpu_chunk, list);
while ((chunk = list_first_entry_or_null(
&pcpu_chunk_lists[pcpu_to_depopulate_slot],
struct pcpu_chunk, list))) {
WARN_ON(chunk->immutable);

/*
Expand Down

0 comments on commit c1f6688

Please sign in to comment.