Skip to contentSkip to conversation

mm: zswap: use ATOMIC_LONG_INIT to initialize zswap_stored_pages

PATCH In review Sun YangKai 3 participants 5 messages Feb 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: zswap: use ATOMIC_LONG_INIT to initialize zswap_stored_pages

This is currently the only atomic_long_t variable initialized by ATOMIC_INIT macro found in the kernel by using
grep -r atomic_long_t | grep ATOMIC_INIT

This was introduced in 6e1fa55, in which we modified the type of zswap_stored_pages to atomic_long_t, but didn't change the initialization.

Fixes 6e1fa55 ("mm: zswap: modify zswap_stored_pages to be atomic_long_t")
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
index ac9d299e7d0c..23365e76a3ce 100644
@@ -43,7 +43,7 @@
 * statistics
 **********************************/
 /* The number of compressed pages currently stored in zswap */
-atomic_long_t zswap_stored_pages = ATOMIC_INIT(0);
+atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0);
 
 /*
  * The statistics below are not protected from concurrent access for
Signature · 1 line
2.48.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Sun YangKai

This is currently the only atomic_long_t variable initialized by ATOMIC_INIT macro found in the kernel by using
grep -r atomic_long_t | grep ATOMIC_INIT

This was introduced in 6e1fa55, in which we modified

We use the first 12 characters in the SHA1 to minimize collisions (same in 'Fixes' below), so both should be 6e1fa555ec77.

Quoted 5 lines

the type of zswap_stored_pages to atomic_long_t,
but didn't change the initialization.

Fixes 6e1fa55 ("mm: zswap: modify zswap_stored_pages to be atomic_long_t")
Quoted 20 lines
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
index ac9d299e7d0c..23365e76a3ce 100644
@@ -43,7 +43,7 @@
 * statistics
 **********************************/
 /* The number of compressed pages currently stored in zswap */
-atomic_long_t zswap_stored_pages = ATOMIC_INIT(0);
+atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0);
 
 /*
  * The statistics below are not protected from concurrent access for
Signature · 1 line
2.48.1
#2 lore raw

PATCH 1/1 mm: zswap: use ATOMIC_LONG_INIT to initialize zswap_stored_pages

In reply to Sun YangKai

This is currently the only atomic_long_t variable initialized by ATOMIC_INIT macro found in the kernel by using
grep -r atomic_long_t | grep ATOMIC_INIT

This was introduced in 6e1fa555ec77, in which we modified the type of zswap_stored_pages to atomic_long_t, but didn't change the initialization.

Fixes 6e1fa555ec77 ("mm: zswap: modify zswap_stored_pages to be atomic_long_t")
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
index ac9d299e7d0c..23365e76a3ce 100644
@@ -43,7 +43,7 @@
 * statistics
 **********************************/
 /* The number of compressed pages currently stored in zswap */
-atomic_long_t zswap_stored_pages = ATOMIC_INIT(0);
+atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0);
 
 /*
  * The statistics below are not protected from concurrent access for
Signature · 1 line
2.48.1
Acked-by on v1 1/1
#3 lore raw

On 26.02.25 16:32, Sun YangKai wrote:

Something for the future: if you send a v2, indicate that in the patch subject ("[PATCH v2]") and ideally, describe the change since v1 under the "---", and don't send it as reply to the original patch.

Quoted 5 lines

This is currently the only atomic_long_t variable initialized by ATOMIC_INIT macro found in the kernel by using
grep -r atomic_long_t | grep ATOMIC_INIT

This was introduced in 6e1fa555ec77, in which we modified

the correct way to reference to commits ids even in text is the format you use below.

But here it's sufficient to not be repetitive and simply say

"We changed the type of zswap_stored_pages to be an atomic_long_t, but didn't change the initialization."

Quoted 22 lines

the type of zswap_stored_pages to atomic_long_t,
but didn't change the initialization.

Fixes 6e1fa555ec77 ("mm: zswap: modify zswap_stored_pages to be atomic_long_t")
---
  mm/zswap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
index ac9d299e7d0c..23365e76a3ce 100644
@@ -43,7 +43,7 @@
  * statistics
  **********************************/
  /* The number of compressed pages currently stored in zswap */
-atomic_long_t zswap_stored_pages = ATOMIC_INIT(0);
+atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0);
 
  /*
   * The statistics below are not protected from concurrent access for
Signature · 3 lines
Cheers,

David / dhildenb
author
#4 lore raw

Very helpful! Thanks for the tips!

Quoted 54 lines · David Hildenbrand

On 26.02.25 16:32, Sun YangKai wrote:

Something for the future: if you send a v2, indicate that in the patch subject ("[PATCH v2]") and ideally, describe the change since v1 under the "---", and don't send it as reply to the original patch.

Quoted 5 lines

This is currently the only atomic_long_t variable initialized by ATOMIC_INIT macro found in the kernel by using
grep -r atomic_long_t | grep ATOMIC_INIT

This was introduced in 6e1fa555ec77, in which we modified

the correct way to reference to commits ids even in text is the format you use below.

But here it's sufficient to not be repetitive and simply say

"We changed the type of zswap_stored_pages to be an atomic_long_t, but didn't change the initialization."

Quoted 4 lines

the type of zswap_stored_pages to atomic_long_t,
but didn't change the initialization.

Fixes 6e1fa555ec77 ("mm: zswap: modify zswap_stored_pages to be

atomic_long_t")

Quoted 10 lines
---
  mm/zswap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +0 -0
index ac9d299e7d0c..23365e76a3ce 100644

mm/zswap.c line 49

Quoted 8 lines
mm/zswap.c +1 -1
@@ -43,7 +43,7 @@
  * statistics
  **********************************/
  /* The number of compressed pages currently stored in zswap */
-atomic_long_t zswap_stored_pages = ATOMIC_INIT(0);
+atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0);
 
  /*
   * The statistics below are not protected from concurrent access for

--
Cheers,

David / dhildenb