Skip to content

Commit 57979fa

Browse files
rgushchinakpm00
authored andcommitted
mm: page_counters: initialize usage using ATOMIC_LONG_INIT() macro
When a page_counter structure is initialized, there is no need to use an atomic set operation to initialize the usage counter because at this point the structure is not visible to anybody else. ATOMIC_LONG_INIT() is what should be used in such cases. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Roman Gushchin <[email protected]> Acked-by: Shakeel Butt <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 941ce63 commit 57979fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/page_counter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static inline void page_counter_init(struct page_counter *counter,
5252
struct page_counter *parent,
5353
bool protection_support)
5454
{
55-
atomic_long_set(&counter->usage, 0);
55+
counter->usage = (atomic_long_t)ATOMIC_LONG_INIT(0);
5656
counter->max = PAGE_COUNTER_MAX;
5757
counter->parent = parent;
5858
counter->protection_support = protection_support;

0 commit comments

Comments
 (0)