diff mbox series

[RFC,v4,11/13] mm/vmscan: Move count_vm_event(DROP_SLAB) into drop_slab()

Message ID 20191212171137.13872-12-david@redhat.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

David Hildenbrand Dec. 12, 2019, 5:11 p.m. UTC
Let's count within the function itself, so every invocation (of future
users) will be counted.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 fs/drop_caches.c | 4 +---
 mm/vmscan.c      | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Michal Hocko Feb. 25, 2020, 2:13 p.m. UTC | #1
On Thu 12-12-19 18:11:35, David Hildenbrand wrote:
> Let's count within the function itself, so every invocation (of future
> users) will be counted.
> 
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-fsdevel@vger.kernel.org
> Signed-off-by: David Hildenbrand <david@redhat.com>

Slight inconsistency with the page cache droppint but nothing earth
shattering.

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  fs/drop_caches.c | 4 +---
>  mm/vmscan.c      | 1 +
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> index d31b6c72b476..a042da782fcd 100644
> --- a/fs/drop_caches.c
> +++ b/fs/drop_caches.c
> @@ -61,10 +61,8 @@ int drop_caches_sysctl_handler(struct ctl_table *table, int write,
>  			iterate_supers(drop_pagecache_sb, NULL);
>  			count_vm_event(DROP_PAGECACHE);
>  		}
> -		if (sysctl_drop_caches & 2) {
> +		if (sysctl_drop_caches & 2)
>  			drop_slab();
> -			count_vm_event(DROP_SLAB);
> -		}
>  		if (!stfu) {
>  			pr_info("%s (%d): drop_caches: %d\n",
>  				current->comm, task_pid_nr(current),
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 5a6445e86328..c3e53502a84a 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -726,6 +726,7 @@ void drop_slab(void)
>  
>  	for_each_online_node(nid)
>  		drop_slab_node(nid);
> +	count_vm_event(DROP_SLAB);
>  }
>  
>  static inline int is_page_cache_freeable(struct page *page)
> -- 
> 2.23.0
diff mbox series

Patch

diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index d31b6c72b476..a042da782fcd 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -61,10 +61,8 @@  int drop_caches_sysctl_handler(struct ctl_table *table, int write,
 			iterate_supers(drop_pagecache_sb, NULL);
 			count_vm_event(DROP_PAGECACHE);
 		}
-		if (sysctl_drop_caches & 2) {
+		if (sysctl_drop_caches & 2)
 			drop_slab();
-			count_vm_event(DROP_SLAB);
-		}
 		if (!stfu) {
 			pr_info("%s (%d): drop_caches: %d\n",
 				current->comm, task_pid_nr(current),
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5a6445e86328..c3e53502a84a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -726,6 +726,7 @@  void drop_slab(void)
 
 	for_each_online_node(nid)
 		drop_slab_node(nid);
+	count_vm_event(DROP_SLAB);
 }
 
 static inline int is_page_cache_freeable(struct page *page)