linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: David Hildenbrand <david@redhat.com>,
	Chen Taotao <chentt10@chinatelecom.cn>,
	akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/rmap: optimize folio_move_anon_rmap()
Date: Tue, 14 May 2024 08:55:43 +0530	[thread overview]
Message-ID: <3ade5078-0105-4d10-86d2-02806d48fbd0@arm.com> (raw)
In-Reply-To: <7a4d4992-4c8a-43b9-8c41-a938bc3cec67@redhat.com>



On 5/13/24 21:07, David Hildenbrand wrote:
> On 12.05.24 14:35, Chen Taotao wrote:
>> When a folio belongs exclusively to one process after a COW event,
>> folio_move_anon_rmap() always moves the folio into the anon_vma
>> belongs only to this process.
>>
>> However, if the folio already belongs to the anon_vma of the this
>> process, we don't need to move it again. In this case, we first
>> check if the folio already belongs to the anna_vma of the this
>> process, and only move it if it does not.
>>
>> The above changes may improve the performance of vm faults in some
>> scenarios, because the performance loss caused by WRITE_ONCE() is
>> much more than the performance loss caused by add a judgment.
> 
> Please proof that by real numbers. I don't think it will make a real difference, and we likely don't want that change.

Agreed, only scenarios when pre-condition check makes any sense is
if subsequent actions are expensive such as writing into registers
etc. But in this case both 'if' and 'WRITE_ONCE' statements are of
comparable cost, hence adding additional conditional check is only
going to increase the cost on average i.e when both gets executed.


      reply	other threads:[~2024-05-14  3:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12 12:35 Chen Taotao
2024-05-13 15:37 ` David Hildenbrand
2024-05-14  3:25   ` Anshuman Khandual [this message]

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=3ade5078-0105-4d10-86d2-02806d48fbd0@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=chentt10@chinatelecom.cn \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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