diff mbox series

[v3,6/8] mm: cleanup WORKINGSET_NODES in workingset

Message ID 20240430060612.2171650-7-shakeel.butt@linux.dev (mailing list archive)
State New
Headers show
Series memcg: reduce memory consumption by memcg stats | expand

Commit Message

Shakeel Butt April 30, 2024, 6:06 a.m. UTC
WORKINGSET_NODES is not exposed in the memcg stats and thus there is no
need to use the memcg specific stat update functions for it. In future
if we decide to expose WORKINGSET_NODES in the memcg stats, we can
revert this patch.

Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
---

Changes since v2:
- N/A

 mm/workingset.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

T.J. Mercier April 30, 2024, 5:32 p.m. UTC | #1
On Mon, Apr 29, 2024 at 11:06 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> WORKINGSET_NODES is not exposed in the memcg stats and thus there is no
> need to use the memcg specific stat update functions for it. In future
> if we decide to expose WORKINGSET_NODES in the memcg stats, we can
> revert this patch.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Reviewed-by: T.J. Mercier <tjmercier@google.com>

> ---
>
> Changes since v2:
> - N/A
>
>  mm/workingset.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/workingset.c b/mm/workingset.c
> index f2a0ecaf708d..c22adb93622a 100644
> --- a/mm/workingset.c
> +++ b/mm/workingset.c
> @@ -618,6 +618,7 @@ struct list_lru shadow_nodes;
>  void workingset_update_node(struct xa_node *node)
>  {
>         struct address_space *mapping;
> +       struct page *page = virt_to_page(node);
>
>         /*
>          * Track non-empty nodes that contain only shadow entries;
> @@ -633,12 +634,12 @@ void workingset_update_node(struct xa_node *node)
>         if (node->count && node->count == node->nr_values) {
>                 if (list_empty(&node->private_list)) {
>                         list_lru_add_obj(&shadow_nodes, &node->private_list);
> -                       __inc_lruvec_kmem_state(node, WORKINGSET_NODES);
> +                       __inc_node_page_state(page, WORKINGSET_NODES);
>                 }
>         } else {
>                 if (!list_empty(&node->private_list)) {
>                         list_lru_del_obj(&shadow_nodes, &node->private_list);
> -                       __dec_lruvec_kmem_state(node, WORKINGSET_NODES);
> +                       __dec_node_page_state(page, WORKINGSET_NODES);
>                 }
>         }
>  }
> @@ -742,7 +743,7 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
>         }
>
>         list_lru_isolate(lru, item);
> -       __dec_lruvec_kmem_state(node, WORKINGSET_NODES);
> +       __dec_node_page_state(virt_to_page(node), WORKINGSET_NODES);
>
>         spin_unlock(lru_lock);
>
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/mm/workingset.c b/mm/workingset.c
index f2a0ecaf708d..c22adb93622a 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -618,6 +618,7 @@  struct list_lru shadow_nodes;
 void workingset_update_node(struct xa_node *node)
 {
 	struct address_space *mapping;
+	struct page *page = virt_to_page(node);
 
 	/*
 	 * Track non-empty nodes that contain only shadow entries;
@@ -633,12 +634,12 @@  void workingset_update_node(struct xa_node *node)
 	if (node->count && node->count == node->nr_values) {
 		if (list_empty(&node->private_list)) {
 			list_lru_add_obj(&shadow_nodes, &node->private_list);
-			__inc_lruvec_kmem_state(node, WORKINGSET_NODES);
+			__inc_node_page_state(page, WORKINGSET_NODES);
 		}
 	} else {
 		if (!list_empty(&node->private_list)) {
 			list_lru_del_obj(&shadow_nodes, &node->private_list);
-			__dec_lruvec_kmem_state(node, WORKINGSET_NODES);
+			__dec_node_page_state(page, WORKINGSET_NODES);
 		}
 	}
 }
@@ -742,7 +743,7 @@  static enum lru_status shadow_lru_isolate(struct list_head *item,
 	}
 
 	list_lru_isolate(lru, item);
-	__dec_lruvec_kmem_state(node, WORKINGSET_NODES);
+	__dec_node_page_state(virt_to_page(node), WORKINGSET_NODES);
 
 	spin_unlock(lru_lock);