From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A8CA3C7DF0 for ; Thu, 7 May 2026 09:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778147054; cv=none; b=DzCkLGZi779iBDAgXLs/rWWPkoTzdu+yVNbSiKLHrjwPmtsvGmQjuqd0b1a/6V8clxtu9lkGpriS/r+ywxWkNWRb34jip4x49nkX8PQuKFckeahsw7YD+2eeyoMFCcnWiP76rW1uenkyLkmajOIwSw8xYPDzf9O/CExetjJYWco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778147054; c=relaxed/simple; bh=auBDbENaqFzZuB8q1yAGElokiVzrbSBS8hLgMcKBfh4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=QZ0LGeoPmayCjCCIopIs69IzBcAIiwWJCbpeWv6d+2365XlkjpjnvvgsyEaPYcDcSz9OlPX/SAWAmSlkGoGesZ5Evo2ekDPj/FEPqwsJVX2qA+wqm+LetASls7StWQXD1AmY5KvimrCmk4WgRhv87uFBnFoK1LhUERviGExF7vY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=qqGF1FM0; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="qqGF1FM0" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1778147045; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=5c9VtdFN5/KRq1vRJj72HmobU8AvCaJrq+Ns3xrJza0=; b=qqGF1FM0nbUu1GpteO0zm9ueKsh13mJaGEDTLRZy3cj8Q89378cphEYe9WZGgs1v7GL7461Y14IvOezNf28zrLVKic9vr0m4m0TlNSjWW0YdOxuFT4Z2bPDWIpV/k+nl7aSTALmw/7f5rOaCQuGl0BrN8gKsi0dKlLTrDwRg+WI= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=ying.huang@linux.alibaba.com;NM=1;PH=DS;RN=44;SR=0;TI=SMTPD_---0X2U3NgQ_1778147040; Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0X2U3NgQ_1778147040 cluster:ay36) by smtp.aliyun-inc.com; Thu, 07 May 2026 17:44:02 +0800 From: "Huang, Ying" To: Shivank Garg Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 2/7] mm/migrate: use migrate_info field instead of private In-Reply-To: <20260428155043.39251-6-shivankg@amd.com> (Shivank Garg's message of "Tue, 28 Apr 2026 15:50:41 +0000") References: <20260428155043.39251-2-shivankg@amd.com> <20260428155043.39251-6-shivankg@amd.com> Date: Thu, 07 May 2026 17:43:59 +0800 Message-ID: <87ecjn3674.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Shivank Garg writes: > Add an unsigned long migrate_info member to the struct folio union and > use it to store migration state (anon_vma pointer and FOLIO_WAS_* > flags) instead of using folio->private. > > No functional change. > > Suggested-by: David Hildenbrand > Signed-off-by: Shivank Garg > --- > include/linux/mm_types.h | 1 + > mm/migrate.c | 14 +++++++------- > 2 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index a308e2c23b82..f52818dcf4d2 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -426,6 +426,7 @@ struct folio { > union { > void *private; > swp_entry_t swap; > + unsigned long migrate_info; > }; > atomic_t _mapcount; > atomic_t _refcount; > diff --git a/mm/migrate.c b/mm/migrate.c > index 0c6a0ab6ecce..03c2a6f7e5e4 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1130,7 +1130,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, > } > > /* > - * To record some information during migration, we use unused private > + * To record some information during migration, we use the migrate_info > * field of struct folio of the newly allocated destination folio. > * This is safe because nobody is using it except us. > */ > @@ -1143,17 +1143,17 @@ enum { > static void __migrate_folio_record(struct folio *dst, > int old_folio_state, struct anon_vma *anon_vma) > { > - dst->private = (void *)anon_vma + old_folio_state; > + dst->migrate_info = (unsigned long)anon_vma | old_folio_state; > } > > static void __migrate_folio_extract(struct folio *dst, > int *old_folio_state, struct anon_vma **anon_vmap) > { > - unsigned long private = (unsigned long)dst->private; > + unsigned long info = dst->migrate_info; > > - *anon_vmap = (struct anon_vma *)(private & ~FOLIO_OLD_STATES); > - *old_folio_state = private & FOLIO_OLD_STATES; > - dst->private = NULL; > + *anon_vmap = (struct anon_vma *)(info & ~FOLIO_OLD_STATES); > + *old_folio_state = info & FOLIO_OLD_STATES; > + dst->migrate_info = 0; > } > > /* Restore the source folio to the original state upon failure */ > @@ -1217,7 +1217,7 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, > return -ENOMEM; > *dstp = dst; > > - dst->private = NULL; > + dst->migrate_info = 0; > > if (!folio_trylock(src)) { > if (mode == MIGRATE_ASYNC) LGTM! Feel free to add my Reviewed-by: Huang Ying in the future versions. --- Best Regards, Huang, Ying