From: Usama Arif <usamaarif642@gmail.com>
To: Barry Song <21cnbao@gmail.com>, Yosry Ahmed <yosryahmed@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kairui Song <ryncsn@gmail.com>,
hanchuanhua@oppo.com, linux-mm@kvack.org,
baolin.wang@linux.alibaba.com, chrisl@kernel.org,
david@redhat.com, hannes@cmpxchg.org, hughd@google.com,
kaleshsingh@google.com, linux-kernel@vger.kernel.org,
mhocko@suse.com, minchan@kernel.org, nphamcs@gmail.com,
ryan.roberts@arm.com, senozhatsky@chromium.org,
shakeel.butt@linux.dev, shy828301@gmail.com, surenb@google.com,
v-songbaohua@oppo.com, willy@infradead.org, xiang@kernel.org,
ying.huang@intel.com, hch@infradead.org,
Hailong Liu <hailong.liu@oppo.com>
Subject: Re: [PATCH v7 2/2] mm: support large folios swap-in for sync io devices
Date: Mon, 23 Sep 2024 11:22:30 +0100 [thread overview]
Message-ID: <2c418b81-8f67-4a45-b4d2-d158fa4f05d9@gmail.com> (raw)
In-Reply-To: <CAGsJ_4wd=6kuwg7v=_ARb+Ay15M8SU776Vjb4rmtiVp8vQg-qA@mail.gmail.com>
On 23/09/2024 00:57, Barry Song wrote:
> On Thu, Sep 5, 2024 at 7:36 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>>
>> [..]
>>>>
>>>> On the other hand, if you read the code of zRAM, you will find zRAM has
>>>> exactly the same mechanism as zeromap but zRAM can even do more
>>>> by same_pages filled. since zRAM does the job in swapfile layer, there
>>>> is no this kind of consistency issue like zeromap.
>>>>
>>>> So I feel for zRAM case, we don't need zeromap at all as there are duplicated
>>>> efforts while I really appreciate your job which can benefit all swapfiles.
>>>> i mean, zRAM has the ability to check "zero"(and also non-zero but same
>>>> content). after zeromap checks zeromap, zRAM will check again:
>>>>
>>>
>>> Yes, so there is a reason for having the zeromap patches, which I have outlined
>>> in the coverletter.
>>>
>>> https://lore.kernel.org/all/20240627105730.3110705-1-usamaarif642@gmail.com/
>>>
>>> There are usecases where zswap/zram might not be used in production.
>>> We can reduce I/O and flash wear in those cases by a large amount.
>>>
>>> Also running in Meta production, we found that the number of non-zero filled
>>> complete pages were less than 1%, so essentially its only the zero-filled pages
>>> that matter.
>>>
>>> I believe after zeromap, it might be a good idea to remove the page_same_filled
>>> check from zram code? Its not really a problem if its kept as well as I dont
>>> believe any zero-filled pages should reach zram_write_page?
>>
>> I brought this up before and Sergey pointed out that zram is sometimes
>> used as a block device without swap, and that use case would benefit
>> from having this handling in zram. That being said, I have no idea how
>> many people care about this specific scenario.
>
> Hi Usama/Yosry,
>
> We successfully gathered page_same_filled data for zram on Android.
> Interestingly,
> our findings differ from yours on zswap.
>
> Hailong discovered that around 85-86% of the page_same_filled data
> consists of zeros,
> while about 15% are non-zero. We suspect that on Android or similar
> systems, some
> graphics or media data might be duplicated at times, such as a red
> block displayed
> on the screen.
>
> Does this suggest that page_same_filled could still provide some
> benefits in zram
> cases?
Hi Barry,
Thanks for the data, its very interesting to know this from mobile side.
Eventhough its not 99% that I observed, I do feel 85% is still quite high.
The 2 main reasons for the patcheset to store zero pages to be
swapped out in a bitmap were for applications that use swap but
not zswap/zram (reducing I/O and flash wear), and simplifying zswap
code. It also meant fewer zswap_entry structs in memory which would
offset the memory usage by bitmap.
Yosry mentioned that Sergey pointed out that zram is sometimes
used as a block device without swap, and that use case would benefit
from having this handling in zram. Will that case also not go through
swap_writepage and therefore be takencare of by swap_info_struct->zeromap?
Also just curious if there are cases in mobile where only swap is used,
but not zswap/zram?
I think even with 85% zero-filled pages, we could get rid of page_same_filled
especially if the zram without swap case is handled by swap_info_struct->zeromap.
But don't have strong preference.
Thanks,
Usama
>
> Thanks
> Barry
next prev parent reply other threads:[~2024-09-23 10:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 7:45 [PATCH v7 0/2] mm: Ignite large folios swap-in support hanchuanhua
2024-08-21 7:45 ` [PATCH v7 1/2] mm: add nr argument in mem_cgroup_swapin_uncharge_swap() helper to support large folios hanchuanhua
2024-08-21 7:45 ` [PATCH v7 2/2] mm: support large folios swap-in for sync io devices hanchuanhua
2024-08-21 17:31 ` Shakeel Butt
2024-08-21 21:13 ` Barry Song
2024-08-23 17:56 ` Shakeel Butt
2024-08-26 19:46 ` Barry Song
2024-08-29 1:01 ` Kanchana P Sridhar
2024-08-29 2:24 ` Barry Song
2024-08-29 2:38 ` Sridhar, Kanchana P
2024-09-03 18:24 ` Kairui Song
2024-09-03 18:38 ` Yosry Ahmed
2024-09-03 20:07 ` Andrew Morton
2024-09-03 21:36 ` Barry Song
2024-09-03 22:05 ` Yosry Ahmed
2024-09-04 21:30 ` Usama Arif
2024-09-04 23:10 ` Barry Song
2024-09-04 23:23 ` Usama Arif
2024-09-04 23:27 ` Barry Song
2024-09-04 23:35 ` Yosry Ahmed
2024-09-22 23:57 ` Barry Song
2024-09-23 10:22 ` Usama Arif [this message]
2024-09-23 12:10 ` Johannes Weiner
2024-09-23 16:53 ` Yosry Ahmed
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=2c418b81-8f67-4a45-b4d2-d158fa4f05d9@gmail.com \
--to=usamaarif642@gmail.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=hailong.liu@oppo.com \
--cc=hanchuanhua@oppo.com \
--cc=hannes@cmpxchg.org \
--cc=hch@infradead.org \
--cc=hughd@google.com \
--cc=kaleshsingh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=ryan.roberts@arm.com \
--cc=ryncsn@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=shakeel.butt@linux.dev \
--cc=shy828301@gmail.com \
--cc=surenb@google.com \
--cc=v-songbaohua@oppo.com \
--cc=willy@infradead.org \
--cc=xiang@kernel.org \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.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;
as well as URLs for NNTP newsgroup(s).