From: Miaohe Lin <linmiaohe@huawei.com>
To: Yang Shi <shy828301@gmail.com>
Cc: NeilBrown <neilb@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Christoph Hellwig <hch@lst.de>, <linux-nfs@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Huang Ying <ying.huang@intel.com>
Subject: Re: [PATCH] MM: handle THP in swap_*page_fs() - count_vm_events()
Date: Mon, 9 May 2022 16:56:42 +0800 [thread overview]
Message-ID: <059786bc-191b-8126-0c76-34dbf2e29159@huawei.com> (raw)
In-Reply-To: <CAHbLzkqtjg6yaPp-yktRtUBo5-Yw9rJKvJWH9PDDHxsuHh6Mhw@mail.gmail.com>
On 2022/5/7 1:26, Yang Shi wrote:
> On Sun, May 1, 2022 at 10:32 PM Matthew Wilcox <willy@infradead.org> wrote:
>>
>> On Mon, May 02, 2022 at 03:28:49PM +1000, NeilBrown wrote:
>>> On Mon, 02 May 2022, Matthew Wilcox wrote:
>>>> On Mon, May 02, 2022 at 02:57:46PM +1000, NeilBrown wrote:
>>>>> @@ -390,9 +392,9 @@ static void sio_read_complete(struct kiocb *iocb, long ret)
>>>>> struct page *page = sio->bvec[p].bv_page;
>>>>>
>>>>> SetPageUptodate(page);
>>>>> + count_swpout_vm_event(page);
>>>>> unlock_page(page);
>>>>> }
>>>>> - count_vm_events(PSWPIN, sio->pages);
>>>>
>>>> Surely that should be count_swpIN_vm_event?
>>>>
>>> I'm not having a good day....
>>>
>>> Certainly shouldn't be swpout. There isn't a count_swpin_vm_event().
>>>
>>> swap_readpage() only counts once for each page no matter how big it is.
>>> While swap_writepage() counts one for each PAGE_SIZE written.
>>>
>>> And we have THP_SWPOUT but not THP_SWPIN
>>
>> _If_ I understand the swap-in patch correctly (at least as invoked by
>> shmem), it won't attempt to swap in an entire THP. Even if it swapped
>> out an order-9 page, it will bring in order-0 pages from swap, and then
>> rely on khugepaged to reassemble them.
>
> Totally correct. The try_to_unmap() called by vmscan would split PMD
> to PTEs then install swap entries for each PTE but keep the huge page
> unsplit.
>
> BTW, there were patches adding THP swapin support, but they were never merged.
Could you please tell me where the THP swapin patches are ? It would be really helpful
if you can kindly figure that out for me! :)
Thanks a lot!
>
>>
>> Someone who actually understands the swap code should check that my
>> explanation here is correct.
>>
> .
>
next prev parent reply other threads:[~2022-05-09 8:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 4:57 NeilBrown
2022-05-02 5:16 ` Matthew Wilcox
2022-05-02 5:28 ` NeilBrown
2022-05-02 5:31 ` Matthew Wilcox
2022-05-06 17:26 ` Yang Shi
2022-05-09 8:56 ` Miaohe Lin [this message]
2022-05-02 5:31 ` [PATCH v2] " NeilBrown
2022-05-09 8:54 ` 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=059786bc-191b-8126-0c76-34dbf2e29159@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=geert+renesas@glider.be \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=shy828301@gmail.com \
--cc=willy@infradead.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