From: Miaohe Lin <linmiaohe@huawei.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: <akpm@linux-foundation.org>, <david@redhat.com>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] mm/swap: remove swap_cache_info statistics
Date: Mon, 20 Jun 2022 17:05:56 +0800 [thread overview]
Message-ID: <67653af6-14a7-2017-74e7-88763f223478@huawei.com> (raw)
In-Reply-To: <87a6a7rc39.fsf@yhuang6-desk2.ccr.corp.intel.com>
On 2022/6/20 16:08, Huang, Ying wrote:
> Miaohe Lin <linmiaohe@huawei.com> writes:
>
>> swap_cache_info are not statistics that could be easily used to tune system
>> performance because they are not easily accessile. Also they can't provide
>> really useful info when OOM occurs. Remove these statistics can also help
>> mitigate unneeded global swap_cache_info cacheline contention.
>>
>> Suggested-by: David Hildenbrand <david@redhat.com>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>> mm/swap_state.c | 17 -----------------
>> 1 file changed, 17 deletions(-)
>>
>> diff --git a/mm/swap_state.c b/mm/swap_state.c
>> index 0a2021fc55ad..41c6a6053d5c 100644
>> --- a/mm/swap_state.c
>> +++ b/mm/swap_state.c
>> @@ -59,24 +59,11 @@ static bool enable_vma_readahead __read_mostly = true;
>> #define GET_SWAP_RA_VAL(vma) \
>> (atomic_long_read(&(vma)->swap_readahead_info) ? : 4)
>>
>> -#define INC_CACHE_INFO(x) data_race(swap_cache_info.x++)
>> -#define ADD_CACHE_INFO(x, nr) data_race(swap_cache_info.x += (nr))
>> -
>> -static struct {
>> - unsigned long add_total;
>> - unsigned long del_total;
>> - unsigned long find_success;
>> - unsigned long find_total;
>> -} swap_cache_info;
>> -
>> static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);
>>
>> void show_swap_cache_info(void)
>> {
>> printk("%lu pages in swap cache\n", total_swapcache_pages());
>> - printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n",
>> - swap_cache_info.add_total, swap_cache_info.del_total,
>> - swap_cache_info.find_success, swap_cache_info.find_total);
>> printk("Free swap = %ldkB\n",
>> get_nr_swap_pages() << (PAGE_SHIFT - 10));
>> printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
>> @@ -133,7 +120,6 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry,
>> address_space->nrpages += nr;
>> __mod_node_page_state(page_pgdat(page), NR_FILE_PAGES, nr);
>> __mod_lruvec_page_state(page, NR_SWAPCACHE, nr);
>> - ADD_CACHE_INFO(add_total, nr);
>> unlock:
>> xas_unlock_irq(&xas);
>> } while (xas_nomem(&xas, gfp));
>> @@ -172,7 +158,6 @@ void __delete_from_swap_cache(struct page *page,
>> address_space->nrpages -= nr;
>> __mod_node_page_state(page_pgdat(page), NR_FILE_PAGES, -nr);
>> __mod_lruvec_page_state(page, NR_SWAPCACHE, -nr);
>> - ADD_CACHE_INFO(del_total, nr);
>> }
>>
>> /**
>> @@ -348,12 +333,10 @@ struct page *lookup_swap_cache(swp_entry_t entry, struct vm_area_struct *vma,
>> page = find_get_page(swap_address_space(entry), swp_offset(entry));
>> put_swap_device(si);
>>
>> - INC_CACHE_INFO(find_total);
>> if (page) {
>> bool vma_ra = swap_use_vma_readahead();
>> bool readahead;
>>
>> - INC_CACHE_INFO(find_success);
>> /*
>> * At the moment, we don't support PG_readahead for anon THP
>> * so let's bail out rather than confusing the readahead stat.
>
> This looks reasonable. And if we want to do some statistics for swap
> cache in the future, we can use BPF, that is even more convenient.
BPF should be very convenient. Many thanks for reviewing!
>
> Acked-by: "Huang, Ying" <ying.huang@intel.com>
>
> Best Regards,
> Huang, Ying
>
> .
>
next prev parent reply other threads:[~2022-06-20 9:06 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 14:40 [PATCH v2 0/3] A few cleanup and fixup patches for swap Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 1/3] mm/swapfile: make security_vm_enough_memory_mm() work as expected Miaohe Lin
2022-06-17 7:33 ` David Hildenbrand
2022-06-18 2:43 ` Miaohe Lin
2022-06-18 7:10 ` David Hildenbrand
2022-06-18 7:31 ` Miaohe Lin
2022-06-20 7:31 ` Huang, Ying
2022-06-20 12:12 ` Miaohe Lin
2022-06-21 1:35 ` Huang, Ying
2022-06-21 7:37 ` Miaohe Lin
2022-06-21 7:42 ` Huang, Ying
2022-06-21 8:20 ` Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 2/3] mm/swapfile: fix possible data races of inuse_pages Miaohe Lin
2022-06-20 7:54 ` Huang, Ying
2022-06-20 9:04 ` Miaohe Lin
2022-06-20 9:23 ` Muchun Song
2022-06-20 12:23 ` Miaohe Lin
2022-06-20 12:32 ` Miaohe Lin
2022-06-20 13:46 ` Qian Cai
2022-06-20 14:20 ` Muchun Song
2022-06-20 21:36 ` Qian Cai
2022-06-21 1:14 ` Huang, Ying
2022-06-21 3:39 ` Muchun Song
2022-06-21 6:40 ` Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 3/3] mm/swap: remove swap_cache_info statistics Miaohe Lin
2022-06-08 15:16 ` David Hildenbrand
2022-06-20 8:08 ` Huang, Ying
2022-06-20 9:05 ` Miaohe Lin [this message]
2022-06-20 9:30 ` Muchun Song
2022-06-17 2:37 ` [PATCH v2 0/3] A few cleanup and fixup patches for swap Andrew Morton
2022-06-17 3:00 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67653af6-14a7-2017-74e7-88763f223478@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®