mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Garg, Shivank" <shivankg@amd.com>,
	"rppt@kernel.org" <rppt@kernel.org>,
	"byungchul@sk.com" <byungchul@sk.com>,
	"rakie.kim@sk.com" <rakie.kim@sk.com>,
	"vbabka@kernel.org" <vbabka@kernel.org>,
	"harry@kernel.org" <harry@kernel.org>,
	"ying.huang@linux.alibaba.com" <ying.huang@linux.alibaba.com>,
	"riel@surriel.com" <riel@surriel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"matthew.brost@intel.com" <matthew.brost@intel.com>,
	"surenb@google.com" <surenb@google.com>,
	"gourry@gourry.net" <gourry@gourry.net>,
	"ziy@nvidia.com" <ziy@nvidia.com>,
	"liam@infradead.org" <liam@infradead.org>,
	"jannh@google.com" <jannh@google.com>,
	"joannelkoong@gmail.com" <joannelkoong@gmail.com>,
	"mhocko@suse.com" <mhocko@suse.com>,
	"ljs@kernel.org" <ljs@kernel.org>,
	"lance.yang@linux.dev" <lance.yang@linux.dev>,
	"joshua.hahnjy@gmail.com" <joshua.hahnjy@gmail.com>,
	"apopple@nvidia.com" <apopple@nvidia.com>
Cc: "Rao, Bharata Bhasker" <bharata@amd.com>,
	"kinseyho@google.com" <kinseyho@google.com>,
	"weixugc@google.com" <weixugc@google.com>,
	"linmiaohe@huawei.com" <linmiaohe@huawei.com>,
	"dev.jain@arm.com" <dev.jain@arm.com>,
	"fvdl@google.com" <fvdl@google.com>,
	"usama.arif@linux.dev" <usama.arif@linux.dev>,
	"kmanaouil.dev@gmail.com" <kmanaouil.dev@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"rientjes@google.com" <rientjes@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] mm/rmap: split try_to_migrate_hugetlb_one() out of try_to_migrate_one()
Date: Wed, 2 Dec 2026 16:39:59 +0100	[thread overview]
Message-ID: <d749c281-9494-4cb3-9cfd-2f75ec1e37fb@kernel.org> (raw)
In-Reply-To: <7c566a3d793dee253be6c17ec01c9b732d5b3a9a.camel@amd.com>

On 12/2/26 16:28, Garg, Shivank wrote:
> On Wed, 2026-12-02 at 16:18 +0100, David Hildenbrand (Arm) wrote:
>> On 12/2/26 15:17, Garg, Shivank wrote:
>>>
>>> Agreed. So I can directly use folio_page(folio, 0) or &folio->page.
>>>
>>> try_to_unmap_poisoned_hugetlb_one() covers both case with this
>>> 	VM_WARN_ON_ONCE(!pte_present(pteval));
>>> 	VM_WARN_ON_ONCE(pte_pfn(pteval) != folio_pfn(folio));
>>>
>>> yes, makes sense. I'll do this in V4.
>>> Thanks for suggestion.
>>
>> If there are ways to have two functions but have them reuse more code, that
>> would also work. But likely there is no easy way to get that done.
> 
> I'm thinking of something like having:
> 
> try_to_unmap_hugetlb_one(..., bool is_migration) {
>         // all duplicate code
> 	if (migration) {
> 		// migration related stuff
> 	} else {
> 
> 	}
> }
> then just call them like:
> 
> try_to_migrate_hugetlb_one() {
> 	try_to_unmap_hugetlb_one(is_migration=true)
> } 
> 
> try_to_unmap_poisoned_hugetlb_one {
> 	try_to_unmap_hugetlb_one(is_migration=false)
> }
> 
> This would remove the duplicate code and also easy.

Right, I was rather thinking of ways that don't require us passing booleans.
Maybe a function pointer to give us the new pte or sth like that ... not sure. :)

-- 
Cheers,

David

  reply	other threads:[~2026-12-02 15:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:53 [PATCH v3 0/3] mm/rmap: batch the unmap of large folios during migration Shivank Garg
2026-11-26  9:53 ` [PATCH v3 1/3] mm/rmap: factor out migration PTE construction Shivank Garg
2026-12-01 10:56   ` David Hildenbrand (Arm)
2026-12-02  2:44   ` Zi Yan
2026-11-26  9:53 ` [PATCH v3 2/3] mm/rmap: split try_to_migrate_hugetlb_one() out of try_to_migrate_one() Shivank Garg
2026-12-01 11:03   ` David Hildenbrand (Arm)
2026-12-02 14:17     ` Garg, Shivank
2026-12-02 15:18       ` David Hildenbrand (Arm)
2026-12-02 15:28         ` Garg, Shivank
2026-12-02 15:39           ` David Hildenbrand (Arm) [this message]
2026-11-26  9:53 ` [PATCH v3 3/3] mm/rmap: batch the unmap of large folios in try_to_migrate_one() Shivank Garg
2026-11-30 20:02 ` [PATCH v3 0/3] mm/rmap: batch the unmap of large folios during migration Ravi Jonnalagadda
2026-12-01  9:46   ` Garg, Shivank

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=d749c281-9494-4cb3-9cfd-2f75ec1e37fb@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=bharata@amd.com \
    --cc=byungchul@sk.com \
    --cc=dev.jain@arm.com \
    --cc=fvdl@google.com \
    --cc=gourry@gourry.net \
    --cc=harry@kernel.org \
    --cc=jannh@google.com \
    --cc=joannelkoong@gmail.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kinseyho@google.com \
    --cc=kmanaouil.dev@gmail.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=rakie.kim@sk.com \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=shivankg@amd.com \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.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®