[Devel] [PATCH] mm: Drop swap_cache_info reporting in vzstat

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jan 5 22:09:09 MSK 2024


On 02.01.2024 03:46, Pavel Tikhomirov wrote:
> Looks good.
> 
> Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> 
> While on it, can we also remove swap_cache_info_struct in
> include/linux/vzstat.h as it looks unused?

Sure, Pasha! All you need is to dream about that - and your New Year's wish is already in place! :))

 >> diff --git a/include/linux/vzstat.h b/include/linux/vzstat.h
...
 >> @@ -14,13 +14,6 @@
 >>    #include <linux/mmzone.h>
 >>    #include <linux/kstat.h>
 >>
 >> -struct swap_cache_info_struct {
 >> -	unsigned long add_total;
 >> -	unsigned long del_total;
 >> -	unsigned long find_success;
 >> -	unsigned long find_total;
 >> -};
 >> -





> 
> On 29/12/2023 01:15, Konstantin Khorenko wrote:
>> Mainstream has dropped swap_cache_info statistics:
>>    442701e7058b ("mm/swap: remove swap_cache_info statistics")
>>
>> So we are dropping reporting it via /proc/vz/stats interface.
>>
>> We could leave the format of /proc/vz/stats file the same (it is an
>> interface after all, should be stable), but as in vz9 we'll have so many
>> changes, vzstat utility is also should be rewritten, so it's a good time
>> to drop the junk code rathen than preserve the interface file format.
>>
>> Of course we inc the format version to 2.7.
>>
>> This patch:
>>    * fully reverts 44a915de19aa ("mm: Export swap_cache_info struct and
>>      variable")
>>    * removes couple of hunks in 5952b9c2f339 ("vzstat: Add vzstat module and
>>      kstat interfaces") - related to swap_cache_info
>>
>> https://virtuozzo.atlassian.net/browse/PSBM-152466
>>
>> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
>>
>> Feature: ve: extra statistics (mm, latency)
>> ---
>>    include/linux/swap.h   |  9 ---------
>>    include/linux/vzstat.h |  7 -------
>>    kernel/ve/vzstat.c     | 16 +---------------
>>    mm/swap_state.c        |  3 ---
>>    4 files changed, 1 insertion(+), 34 deletions(-)
>>
>> diff --git a/include/linux/swap.h b/include/linux/swap.h
>> index 9348574b5bb7..1af5b711bc00 100644
>> --- a/include/linux/swap.h
>> +++ b/include/linux/swap.h
>> @@ -715,14 +715,5 @@ static inline bool mem_cgroup_swap_full(struct page *page)
>>    }
>>    #endif
>>    
>> -struct swap_cache_info {
>> -	unsigned long add_total;
>> -	unsigned long del_total;
>> -	unsigned long find_success;
>> -	unsigned long find_total;
>> -};
>> -
>> -extern struct swap_cache_info swap_cache_info;
>> -
>>    #endif /* __KERNEL__*/
>>    #endif /* _LINUX_SWAP_H */
>> diff --git a/include/linux/vzstat.h b/include/linux/vzstat.h
>> index 505487117ca4..4a5738bd036f 100644
>> --- a/include/linux/vzstat.h
>> +++ b/include/linux/vzstat.h
>> @@ -14,13 +14,6 @@
>>    #include <linux/mmzone.h>
>>    #include <linux/kstat.h>
>>    
>> -struct swap_cache_info_struct {
>> -	unsigned long add_total;
>> -	unsigned long del_total;
>> -	unsigned long find_success;
>> -	unsigned long find_total;
>> -};
>> -
>>    struct kstat_zone_avg {
>>    	unsigned long		free_pages_avg[3],
>>    				nr_active_avg[3],
>> diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
>> index 7ffd5ec7f2a3..73063a4189d7 100644
>> --- a/kernel/ve/vzstat.c
>> +++ b/kernel/ve/vzstat.c
>> @@ -27,7 +27,6 @@
>>    #include <linux/kthread.h>
>>    #include <linux/freezer.h>
>>    #include <linux/veowner.h>
>> -#include <linux/swap.h>
>>    
>>    #include <linux/vzstat.h>
>>    
>> @@ -385,18 +384,6 @@ static void kernel_text_csum_seq_show(struct seq_file *m, void *v)
>>    	seq_printf(m, "kernel_text_csum_broken: %d\n", 0);
>>    }
>>    
>> -static void swap_cache_seq_show(struct seq_file *m, void *v)
>> -{
>> -	struct swap_cache_info *swpcache;
>> -
>> -	swpcache = &swap_cache_info;
>> -	seq_printf(m, "Swap cache: add %lu, del %lu, find %lu/%lu\n",
>> -			swpcache->add_total,
>> -			swpcache->del_total,
>> -			swpcache->find_success,
>> -			swpcache->find_total);
>> -}
>> -
>>    /*
>>     * Declare special structure to store summarized statistics. The 'struct zone'
>>     * is not used because of it's tremendous size.
>> @@ -668,14 +655,13 @@ static int stats_seq_show(struct seq_file *m, void *v)
>>    {
>>    	if (!v)
>>    		return 0;
>> -	seq_puts(m, "Version: 2.6\n");
>> +	seq_puts(m, "Version: 2.7\n");
>>    	cycles_per_jiffy_show(m, v);
>>    	jiffies_per_second_show(m, v);
>>    	seq_puts(m, "\nLoad info:\n");
>>    	task_counts_seq_show(m, v);
>>    	seq_puts(m, "\nMemory info:\n");
>>    	kernel_text_csum_seq_show(m, v);
>> -	swap_cache_seq_show(m, v);
>>    	mem_free_areas_show(m, v);
>>    	mem_avg_show(m, v);
>>    	mem_fails_show(m, v);
>> diff --git a/mm/swap_state.c b/mm/swap_state.c
>> index 034dd5d0c6d9..b16dc348bbd2 100644
>> --- a/mm/swap_state.c
>> +++ b/mm/swap_state.c
>> @@ -59,9 +59,6 @@ static bool enable_vma_readahead __read_mostly = true;
>>    #define GET_SWAP_RA_VAL(vma)					\
>>    	(atomic_long_read(&(vma)->swap_readahead_info) ? : 4)
>>    
>> -struct swap_cache_info swap_cache_info;
>> -EXPORT_SYMBOL_GPL(swap_cache_info);
>> -
>>    static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);
>>    
>>    void show_swap_cache_info(void)
> 


More information about the Devel mailing list