From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D562C2BD09 for ; Thu, 27 Jun 2024 06:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96BCF6B0083; Thu, 27 Jun 2024 02:00:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91B046B0089; Thu, 27 Jun 2024 02:00:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BB576B008A; Thu, 27 Jun 2024 02:00:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5CF226B0083 for ; Thu, 27 Jun 2024 02:00:41 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 027641419F6 for ; Thu, 27 Jun 2024 06:00:40 +0000 (UTC) X-FDA: 82275619482.01.4A2F034 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf22.hostedemail.com (Postfix) with ESMTP id 791EBC0007 for ; Thu, 27 Jun 2024 06:00:38 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=gCffxV56; spf=pass (imf22.hostedemail.com: domain of donettom@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=donettom@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719468026; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0xR0tHs9mClySZ31dR3jVFeUkofeuAtLj2PHkle04wM=; b=Ui4MZfmcyqGVZAh64z4JMShMymtCCURUdswbp5sBtLuvgEqCzdWzkRNYdlmPN2yb9Jb5Y7 gpw/cmNWnEscS8hQY9GBlXOTLNcPA6Em/+VaQa+Y40Ahy3VyDdLDpn8TPeaDTMYzzQN/yQ qiWYqUVTOG926ak9RiKX46nFqotTYzM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=gCffxV56; spf=pass (imf22.hostedemail.com: domain of donettom@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=donettom@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719468026; a=rsa-sha256; cv=none; b=z575Wz3X9G1ghpJ/YOhYp5/lRFwVG/RMevq3nVahrhiy4VIF+AoFAHOX/f5wPY8CGCI04A /pSz2MOFEQ/JLHSGWu//OBmslUeKEeuPBCCoYavCNaUxGoP276UhUul1zNufI71ddmueUG 0iwon9rBPy2+hgp1AQB8SYY4w62xKpA= Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45R5RxBu029477; Thu, 27 Jun 2024 06:00:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=pp1; bh=0 xR0tHs9mClySZ31dR3jVFeUkofeuAtLj2PHkle04wM=; b=gCffxV56kfznU4xZo roB7KrB5sPtg7KatTjysWDt76udxxPChhwCUnEgte2EH4gu+ZgcOVMViuTPONgEW kVCItb17T8ic7VhuDL/ptCuepHxHDc4qeUbrJ0Qc9rKPn+CpkOnGwxb2r6tKdc+w 0aBGvaEZp3+rfVET9UQzetB8Ep/jBTTcytqBcq/HPTKW273Tthu/fQYgJI/mIIQq Gi5kh1COr6bLxPxK1jagldwN4lLlPBYqRHp/uRZ7ebYJVdsAAf23WIbRlMprE/tE 2LUJU7v3EWhzGiasc20XxhzYT+Bzuny+yJJj8G7+5jJl+tNUTegqs8W+idA3tywE OSHjg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400yaw0bq1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 06:00:36 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45R60aPJ022026; Thu, 27 Jun 2024 06:00:36 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 400yaw0bpy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 06:00:35 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45R3Wa5r008183; Thu, 27 Jun 2024 06:00:34 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9b118rp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 06:00:34 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45R60VFK40370802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2024 06:00:34 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7CCCE58054; Thu, 27 Jun 2024 06:00:29 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E53AF58064; Thu, 27 Jun 2024 06:00:27 +0000 (GMT) Received: from [9.109.245.191] (unknown [9.109.245.191]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jun 2024 06:00:27 +0000 (GMT) Message-ID: <4748f87e-0762-40fc-ab9e-577c9739066f@linux.ibm.com> Date: Thu, 27 Jun 2024 11:30:26 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/2] mm/migrate: move NUMA hinting fault folio isolation + checks under PTL To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Andrew Morton References: <20240620212935.656243-1-david@redhat.com> <20240620212935.656243-3-david@redhat.com> <8f85c31a-e603-4578-bf49-136dae0d4b69@redhat.com> Content-Language: en-US From: Donet Tom In-Reply-To: <8f85c31a-e603-4578-bf49-136dae0d4b69@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9aSEh46fcGJ41bHlYQSuh0XRIudn5-XY X-Proofpoint-GUID: fD3HInaw9n4W3uDLS0ODJ8G2glp2YjZz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-27_02,2024-06-25_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270043 X-Stat-Signature: wj1tzf398ht7q6k48w5mc38fzzyjjr9j X-Rspam-User: X-Rspamd-Queue-Id: 791EBC0007 X-Rspamd-Server: rspam02 X-HE-Tag: 1719468038-125876 X-HE-Meta: U2FsdGVkX18qK4r3BcfxBnAoUvaBCzsSeYAGU1oaJshM0dSFu8I0t0oYKEjh8LmpanNaSgjgOlKdetnbbFAlH/+0jDkVkxu1kntvfE/aGWok6o8PQa002UZMJYyktse1aBRSNvvM89KiyRY8hO4c45zsxMnbBK0wSn+H5ZckpH/u3E/M/tB6BShXb5X5kccnM+h/rhWEkSCY7A4OPhTC7wLm5aGR7RxwexUB1OpZ4lTfnaWyyDNIo+nkFU1GxB6FhtauqMRNlMAVCgDt+JSDid8T8NAitni6Y0ly9P23T907tfoDskghviLD7H0dKb8sBya/N94nhQdyLsSvwhRo4bz+jr7KNDlTooXDWWtfk5ULo6HDXJLfZ5GdFNyi9O3UxinIEGJYdq+DhoO7bfc4a8jgZSGmExsrpODsozyD1UdXIsKhzNL+Us3E5eziWdMteEXwon3NTXUdd1wH0/I3A21JTDAFPPqil9TuWn16xFtVK8KwOE5677bLO80tnp2tY2l6GJEObaVTslOvscW3zeD73aTdKBR/mKamGiYbyXxQUJsWJIigV2KSbZHSKjpuhE5FbcmHGuN37wAczcBXAR1CtMFNUVGkXCxmDfNaZCvuScQjbBJmlkyRH070IJ4DG+7/i3wNRtVaqOdrdNF1r/XreKRg2f0KGr2jzE4+LSA5VwVDwg9tv8AQwyq07taKuo9CBmw10r7pNNw0riLTJ70U6X4hWyd4GoD2cIV4GU/29whCouh8NglIWlVhTx9mvfaPWBpa3XSCsmh5KL9zPHlqQiokr4b5HSQn/Pt8+wMr1LSNhhuOL/Zvp2+9YVEpSp1yHiMGPuDp0mwNi/Z1hB5+4A87VMUNaP8sTXSDi7ydPQta1o72AdbJMG/6uWMdsGgKRL2jaPTrdy7PVY/PRG7LkKH/bVA2331sPWvv79fCJelUzMO48jvOqM2wro8kPO4Wga1Gx6W9ZtxcBgI uJyX73IT 5ag/b5cP25DOok2/YB2VaveKq6GNE6SNg4RBzSYQ123sVPdpFiKOF4PGDS4qo0rBOmNuoduu/iHGIHc6vb6R4M6tU1OYLftxJ2KTpRtoBmM2Qs4OxI0Tn/AhcnG7lsgY1ZdoM0uh8U+6KjzktRoHj2yY3kgUhdJGoYeaIO44wAwSp4KrSXbbsAqaVBKtFwAIaEw0eN4ReSUQnYBxV+IUW/TwvxQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 6/26/24 21:52, David Hildenbrand wrote: > On 20.06.24 23:29, David Hildenbrand wrote: >> Currently we always take a folio reference even if migration will not >> even be tried or isolation failed, requiring us to grab+drop an >> additional >> reference. >> >> Further, we end up calling folio_likely_mapped_shared() while the folio >> might have already been unmapped, because after we dropped the PTL, that >> can easily happen. We want to stop touching mapcounts and friends from >> such context, and only call folio_likely_mapped_shared() while the folio >> is still mapped: mapcount information is pretty much stale and >> unreliable >> otherwise. >> >> So let's move checks into numamigrate_isolate_folio(), rename that >> function to migrate_misplaced_folio_prepare(), and call that function >> from callsites where we call migrate_misplaced_folio(), but still with >> the PTL held. >> >> We can now stop taking temporary folio references, and really only take >> a reference if folio isolation succeeded. Doing the >> folio_likely_mapped_shared() + golio isolation under PT lock is now >> similar >> to how we handle MADV_PAGEOUT. >> >> While at it, combine the folio_is_file_lru() checks. >> >> Signed-off-by: David Hildenbrand >> --- > > Donet just reported an issue. I suspect this fixes it -- in any case, > this is > the right thing to do. > > From 0833b9896e98c8d88c521609c811a220d14a2e7e Mon Sep 17 00:00:00 2001 > From: David Hildenbrand > Date: Wed, 26 Jun 2024 18:14:44 +0200 > Subject: [PATCH] Fixup: mm/migrate: move NUMA hinting fault folio > isolation + >  checks under PTL > > Donet reports an issue during NUMA migration we haven't seen previously: > >     [   71.422804] list_del corruption, c00c00000061b3c8->next is >     LIST_POISON1 (5deadbeef0000100) >     [   71.422839] ------------[ cut here ]------------ >     [   71.422843] kernel BUG at lib/list_debug.c:56! >     [   71.422850] Oops: Exception in kernel mode, sig: 5 [#1] > > We forgot to convert one "return 0;" to return an error instead from > migrate_misplaced_folio_prepare() in case the target node is nearly > full. > > Signed-off-by: David Hildenbrand > --- >  mm/migrate.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 8beedbb42a93..9ed43c1eea5e 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -2564,7 +2564,7 @@ int migrate_misplaced_folio_prepare(struct folio > *folio, >          int z; > >          if (!(sysctl_numa_balancing_mode & > NUMA_BALANCING_MEMORY_TIERING)) > -            return 0; > +            return -EAGAIN; >          for (z = pgdat->nr_zones - 1; z >= 0; z--) { >              if (managed_zone(pgdat->node_zones + z)) >                  break; Hi David I tested with this patch . The issue is resolved. I am not seeing the kernel panic. I also tested the page migration. It working fine. numa_pte_updates 1262330 numa_huge_pte_updates 0 numa_hint_faults 925797 numa_hint_faults_local 3780 numa_pages_migrated 327930 pgmigrate_success 822530 Thanks Donet > > base-commit: 4b17ce353e02b47b00e2fe87b862f09e8b9a47e6