[01/20] mm: zswap: rename zswap_free_entry to zswap_entry_free

Message ID 20240130014208.565554-2-hannes@cmpxchg.org
State New
Headers
Series mm: zswap: cleanups |

Commit Message

Johannes Weiner Jan. 30, 2024, 1:36 a.m. UTC
  There is a zswap_entry_ namespace with multiple functions already.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/zswap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Chengming Zhou Jan. 30, 2024, 3:13 a.m. UTC | #1
On 2024/1/30 09:36, Johannes Weiner wrote:
> There is a zswap_entry_ namespace with multiple functions already.

Another is zswap_invalidate_entry(), maybe zswap_entry_invalidate is better.

> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/zswap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 7f88b3a77e4a..173f2e6657de 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -520,7 +520,7 @@ static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
>   * Carries out the common pattern of freeing and entry's zpool allocation,
>   * freeing the entry itself, and decrementing the number of stored pages.
>   */
> -static void zswap_free_entry(struct zswap_entry *entry)
> +static void zswap_entry_free(struct zswap_entry *entry)
>  {
>  	if (!entry->length)
>  		atomic_dec(&zswap_same_filled_pages);
> @@ -555,7 +555,7 @@ static void zswap_entry_put(struct zswap_entry *entry)
>  	WARN_ON_ONCE(refcount < 0);
>  	if (refcount == 0) {
>  		WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
> -		zswap_free_entry(entry);
> +		zswap_entry_free(entry);
>  	}
>  }
>
  
Johannes Weiner Jan. 30, 2024, 3:19 a.m. UTC | #2
On Tue, Jan 30, 2024 at 11:13:16AM +0800, Chengming Zhou wrote:
> On 2024/1/30 09:36, Johannes Weiner wrote:
> > There is a zswap_entry_ namespace with multiple functions already.
> 
> Another is zswap_invalidate_entry(), maybe zswap_entry_invalidate is better.

You're right.

I originally had a patch for that, but then dropped it because it is
sort of also a tree operation and it looked a bit weird to me.

But I could be persuaded to include it again, no strong preferences
either way.

Thanks
  
Chengming Zhou Jan. 30, 2024, 3:21 a.m. UTC | #3
On 2024/1/30 11:19, Johannes Weiner wrote:
> On Tue, Jan 30, 2024 at 11:13:16AM +0800, Chengming Zhou wrote:
>> On 2024/1/30 09:36, Johannes Weiner wrote:
>>> There is a zswap_entry_ namespace with multiple functions already.
>>
>> Another is zswap_invalidate_entry(), maybe zswap_entry_invalidate is better.
> 
> You're right.
> 
> I originally had a patch for that, but then dropped it because it is
> sort of also a tree operation and it looked a bit weird to me.

Right.

> 
> But I could be persuaded to include it again, no strong preferences
> either way.

Never mind.
  
Chengming Zhou Jan. 30, 2024, 3:36 a.m. UTC | #4
On 2024/1/30 09:36, Johannes Weiner wrote:
> There is a zswap_entry_ namespace with multiple functions already.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>

> ---
>  mm/zswap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 7f88b3a77e4a..173f2e6657de 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -520,7 +520,7 @@ static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
>   * Carries out the common pattern of freeing and entry's zpool allocation,
>   * freeing the entry itself, and decrementing the number of stored pages.
>   */
> -static void zswap_free_entry(struct zswap_entry *entry)
> +static void zswap_entry_free(struct zswap_entry *entry)
>  {
>  	if (!entry->length)
>  		atomic_dec(&zswap_same_filled_pages);
> @@ -555,7 +555,7 @@ static void zswap_entry_put(struct zswap_entry *entry)
>  	WARN_ON_ONCE(refcount < 0);
>  	if (refcount == 0) {
>  		WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
> -		zswap_free_entry(entry);
> +		zswap_entry_free(entry);
>  	}
>  }
>
  
Yosry Ahmed Jan. 30, 2024, 8:08 a.m. UTC | #5
On Mon, Jan 29, 2024 at 08:36:37PM -0500, Johannes Weiner wrote:
> There is a zswap_entry_ namespace with multiple functions already.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Yosry Ahmed <yosryahmed@google.com>

Thanks.
  
Nhat Pham Jan. 30, 2024, 9:11 a.m. UTC | #6
On Mon, Jan 29, 2024 at 5:42 PM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> There is a zswap_entry_ namespace with multiple functions already.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Nhat Pham <nphamcs@gmail.com>

> ---
>  mm/zswap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 7f88b3a77e4a..173f2e6657de 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -520,7 +520,7 @@ static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
>   * Carries out the common pattern of freeing and entry's zpool allocation,
>   * freeing the entry itself, and decrementing the number of stored pages.
>   */
> -static void zswap_free_entry(struct zswap_entry *entry)
> +static void zswap_entry_free(struct zswap_entry *entry)
>  {
>         if (!entry->length)
>                 atomic_dec(&zswap_same_filled_pages);
> @@ -555,7 +555,7 @@ static void zswap_entry_put(struct zswap_entry *entry)
>         WARN_ON_ONCE(refcount < 0);
>         if (refcount == 0) {
>                 WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
> -               zswap_free_entry(entry);
> +               zswap_entry_free(entry);
>         }
>  }
>
> --
> 2.43.0
>
  

Patch

diff --git a/mm/zswap.c b/mm/zswap.c
index 7f88b3a77e4a..173f2e6657de 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -520,7 +520,7 @@  static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
  * Carries out the common pattern of freeing and entry's zpool allocation,
  * freeing the entry itself, and decrementing the number of stored pages.
  */
-static void zswap_free_entry(struct zswap_entry *entry)
+static void zswap_entry_free(struct zswap_entry *entry)
 {
 	if (!entry->length)
 		atomic_dec(&zswap_same_filled_pages);
@@ -555,7 +555,7 @@  static void zswap_entry_put(struct zswap_entry *entry)
 	WARN_ON_ONCE(refcount < 0);
 	if (refcount == 0) {
 		WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
-		zswap_free_entry(entry);
+		zswap_entry_free(entry);
 	}
 }