From: David Hildenbrand <david@redhat.com>
To: Alex Shi <seakeel@gmail.com>,
alexs@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
izik.eidus@ravellosystems.com, willy@infradead.org,
aarcange@redhat.com, chrisw@sous-sol.org, hughd@google.com
Subject: Re: [PATCH 01/10] mm/ksm: reduce the flush action for ksm merging page
Date: Wed, 5 Jun 2024 12:00:55 +0200 [thread overview]
Message-ID: <9100f283-ab44-4481-a73c-5b5d5fabd01a@redhat.com> (raw)
In-Reply-To: <1a4f8984-e262-4611-81ec-6ea12fa5b20d@gmail.com>
On 05.06.24 11:49, Alex Shi wrote:
>
>
> On 6/5/24 5:14 PM, David Hildenbrand wrote:
>> On 05.06.24 11:10, Alex Shi wrote:
>>>
>>>
>>> On 6/5/24 3:26 PM, David Hildenbrand wrote:
>>>> On 04.06.24 15:02, Alex Shi wrote:
>>>>>
>>>>>
>>>>> On 6/4/24 6:45 PM, David Hildenbrand wrote:
>>>>>> On 04.06.24 12:26, Alex Shi wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 6/4/24 4:07 PM, David Hildenbrand wrote:
>>>>>>>> On 04.06.24 06:24, alexs@kernel.org wrote:
>>>>>>>>> From: "Alex Shi (tencent)" <alexs@kernel.org>
>>>>>>>>>
>>>>>>>>> We can put off the flush action util a merging is realy coming. That
>>>>>>>>> could reduce some unmerge page flushing.
>>>>>>>>> BTW, flushing only do at arm, mips and few other archs.
>>>>>>>>>
>>>>>>>>
>>>>>>>> I'm no expert on that flushing, but I thought we would have to do the flushing before accessing page content -- before calculating the checksum etc.
>>>>>>>>
>>>>>>>> Now you would only do it before the pages_identical() check, but not when calculating the checksum.
>>>>>>>>
>>>>>>>
>>>>>>> Hi David,
>>>>>>>
>>>>>>> Thanks a lot for comments!
>>>>>>>
>>>>>>> If calc_checksum() is wrong before pages_idential(), (that's just after page was write_protected, that's a real guarantee for page context secured) pages_identical could recheck and make thing right.
>>>>>>>
>>>>>>
>>>>>> Yes, but you would get more wrong checksums, resulting in more unnecessary pages_identical() checks.
>>>>>>
>>>>>> That is missing from the description, and why we want to change that behavior.
>>>>>>
>>>>>> What's the net win?
>>>>>>
>>>>>>> And as to 2 flush functions here, I didn't see the guarantee for other writer from any other place. So maybe we should remove these flush action?
>>>>>>
>>>>>> "I didn't see the guarantee for other writer from any other place" can you rephrase your comment?
>>>>>>
>>>>>> If you mean "the process could modify that page concurrently", then you are right. But that's different than "the process modified the page in the past and we are reading stale content because we missed a flush".
>>>>>
>>>>>
>>>>> Maybe moving the flush before checksum could relief some worries. :)
>>>>> But still no one knows what flush really help, since if page content only syncs to memory by the flush, the kernel or process can't be work with current code.
>>>>
>>>> Please explain to me why we care about moving the flushs at all :)
>>>>
>>>> If they are NOP on most architectures either way, why not simply leave them there and call it a day?
>>> Uh, 2 reasons:
>>> 1, it uses page and can't convert to folio now.
>>> 2, as you pointed, flush action w/o page reading seems just waste time.
>>
>> Alex, I don't think the approach you take for coming up with the current set of patches is a good idea.
>>
>> Please reconsider what you can actually convert to folios and what must stay pages for now due to support for large folios in that code.
>>
>> Then, please explain properly why changes are required and why they are safe.
>>
>> For example, for in scan_get_next_rmap_item() we really *need* the page and not just the folio. So just leave the flushing there and be done with it.
>>
>
> Hi David,
>
> Thanks a lot for your review.
> Though all patches are passed in kernel selftest, but if we do care the saving more than quick processing, the main purpose of this patchset is gone. I'll drop this series.
I think there is value in more folio conversion, but we really have to
be careful when we still want to/have to work on pages (folio+page pair).
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-06-05 10:01 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 4:24 [PATCH 00/10] use folio in ksm alexs
2024-06-04 4:24 ` [PATCH 01/10] mm/ksm: reduce the flush action for ksm merging page alexs
2024-06-04 8:07 ` David Hildenbrand
2024-06-04 10:26 ` Alex Shi
2024-06-04 10:45 ` David Hildenbrand
2024-06-04 13:02 ` Alex Shi
2024-06-05 7:26 ` David Hildenbrand
2024-06-05 9:10 ` Alex Shi
2024-06-05 9:14 ` David Hildenbrand
2024-06-05 9:49 ` Alex Shi
2024-06-05 10:00 ` David Hildenbrand [this message]
2024-06-04 4:24 ` [PATCH 02/10] mm/ksm: skip subpages of compound pages alexs
2024-06-04 8:12 ` David Hildenbrand
2024-06-04 10:31 ` Alex Shi
2024-06-04 10:43 ` David Hildenbrand
2024-06-04 13:10 ` Alex Shi
2024-06-04 13:14 ` David Hildenbrand
2024-06-05 3:58 ` Alex Shi
2024-06-05 7:40 ` David Hildenbrand
2024-06-05 3:52 ` Matthew Wilcox
2024-06-05 6:14 ` Alex Shi
2024-06-05 7:47 ` David Hildenbrand
2024-06-05 21:12 ` Matthew Wilcox
2024-06-06 7:11 ` David Hildenbrand
2024-06-04 4:24 ` [PATCH 03/10] mm/ksm: use folio in try_to_merge_one_page alexs
2024-06-04 8:19 ` David Hildenbrand
2024-06-05 3:38 ` Alex Shi
2024-06-04 4:24 ` [PATCH 04/10] mm/ksm: add identical_folio func alexs
2024-06-04 8:25 ` David Hildenbrand
2024-06-04 4:24 ` [PATCH 05/10] mm/ksm: use folio in stable_tree_search alexs
2024-06-04 4:24 ` [PATCH 06/10] mm/ksm: remove page_stable_node alexs
2024-06-04 4:24 ` [PATCH 07/10] mm/ksm: use folio in unstable_tree_search_insert alexs
2024-06-04 4:24 ` [PATCH 08/10] mm/ksm: use folio in try_to_merge_xx serie funcs alexs
2024-06-04 4:24 ` [PATCH 09/10] mm/ksm: calc_checksum for folio alexs
2024-06-04 13:18 ` David Hildenbrand
2024-06-05 3:44 ` Alex Shi
2024-06-05 7:53 ` David Hildenbrand
2024-06-04 4:24 ` [PATCH 10/10] m/ksm: use folio in ksm scan path alexs
2024-06-04 13:28 ` [PATCH 00/10] use folio in ksm David Hildenbrand
2024-06-05 3:46 ` Alex Shi
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=9100f283-ab44-4481-a73c-5b5d5fabd01a@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=chrisw@sous-sol.org \
--cc=hughd@google.com \
--cc=izik.eidus@ravellosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=seakeel@gmail.com \
--cc=willy@infradead.org \
/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