From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 379543E0C7B for ; Mon, 27 Jul 2026 15:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785167841; cv=none; b=j9yyvqf48Ke+3kXRU/i4d1etYzSHCRJdDUzzfrMv6piWYAUWuc/fovarMSgxQY+drMROBK4ei1jNF92jOApFWtIuoE+i4jF4sLuTv1a89HBTQb4dCH4QCKENk+0/2oSqPbQsH/sxOtvECRTMX1b/y4Pai5Dc+LcPIcO3FJLg9PE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785167841; c=relaxed/simple; bh=7XH6Ol3Cld6iXeAW7L+udsT7InJ3tFLw1dnpl4MyKNw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KQGHj3QXdOhlZTRjEhxn2+EUK0qkVpBMLJeJ9EHZ+IM+dII4Zp8RMeURqTXc38bGL+sXibFtYTMaNbksnNcp+XBnqIAod8u1aqy10DqNWkyXnyglL9BnJKnnrsAvmVPIYbIaHdFoszes6O0Hd2/meEHsj0+8Dbo6efcD5ypxCsA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=IdYusdl3; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="IdYusdl3" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-92e4fd65b2bso161846985a.0 for ; Mon, 27 Jul 2026 08:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1785167838; x=1785772638; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=tsjdjJOss8ZPRd2OUIRraaCz1T4f5WbswiL+iOMIAm4=; b=IdYusdl3nvngFArVR/4/MlQKoU+o2dj3CwnsEjLNTByQ6JcgtWA4XHO2bEU4oln7d3 VcrYKaE4xx7MQDRxql/1FvlCmKzuSVLb8+PweFzwwbQHQAXTkb1dMGlzOM/Rrc1E4+r7 0L3PLfAndIbTEsSdtB7UsvWOKiIamdko2U2Dcd9MGijKhQig+IJm8wpDECzk9Uu5bomx Y1dfPpIA8hhtYswI+f2jmITZY2R6eRMrKQYNFsRKqJ+h/eJTSNQDkJOqXFuN7wixGxdz 5WyDuUQDLD6NhdP/QwBqya5XYYx8JqUZPlCnkmdH/ABQQ82WsZL1ALuG5neHTqNNDBef INWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785167838; x=1785772638; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tsjdjJOss8ZPRd2OUIRraaCz1T4f5WbswiL+iOMIAm4=; b=joU93A9jsmbmbZJYrp5zGvUu+zYp6UFJr3AJiST/5BorzbHZnDEwcxNg6qgqzoXAF2 r1DqmQ+xFWLy8lE76z3wALQAy7AVVCFgkRoRL0vV6N9CoJ4BIr4NsEuoespKGkUdpGJP AZwZSr7PUS6fcTTd/r4FRjWaMyFj1TRe2QXV7EpJBExuXADpmCzB030nRf4hob9KljYJ K0MqZ0x9RvWiKQo032Lueg2rgUYdWlyVooPrTfP98xDcTxA7azwIW6YokNBPjgoRw1aO hOlPv4wBEn0MhLTqv956dAooSsNvaGOjY5JKzwKroyEdsy/kbCZdLPg7Oe5nwWK7Msq6 ik7Q== X-Forwarded-Encrypted: i=1; AHgh+RqGpK7h2nXYDbtq41fWNqYLcCW8k0mQd+SzLWKeH+8ih0dnAlYs1UGMTIGEM7eM9xYTbifyX0nu+R3dvE8=@vger.kernel.org X-Gm-Message-State: AOJu0YzF164Zfe0WnlO3bbD2Pe4a1rckori34Sczk2lnbUF/PzBXaL5o KcT9hkmxtjulm/q0STRXeXLHPRBA0Dm67sH1Nk6VuB06XaxlYhrROr8PEmoxScjyKOY= X-Gm-Gg: AR+sD13rQnPiTkO1aeToZffHPTjysB1SqbvKRlm5eizGLWpB1G1YRFESXIgLkzapi0Z LvOFNwMOvPp2mMDEbqbgv49cwR6obXlZbIy4L4ldFQoNsvq+6yTgL3cG48aFe6AX2EmO79Sjkiq Nv9o14+w8KZxiCoGoSi6djyHzH6kV8U4/bE5vOnBmk4O07Ydq9/LeuE7zwzpMaF1W/V/id8hMhk KvlxiYtXmnNwq2ylnOOtS6BuOt56wABW2ozKGkrsp1ED9lyBnBNk9alQ+H4kn1hVRsUTFalG2SJ oS+GQ03ScSPVdrthwmK+lhDN1MxUBg58v2wg4KsGOhuHpYOsXjSdPvPtGbzx2eC2H3t8XXpOdxJ m+k2BALSxOyl7aHV3osdXsDv+eBVQnzJb2nac3bvt35R1DausY+Q5OsjuWWvg5FyzqKrmet3fj4 o3yBC4dN7GZB1YuehaAx7okeX3fLQoinhQYyL2fgeKqNgA4CsliO+HlpJKSQ== X-Received: by 2002:a05:620a:3910:b0:930:fbdd:c242 with SMTP id af79cd13be357-932df67421dmr1063178185a.29.1785167837883; Mon, 27 Jul 2026 08:57:17 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-932de65239asm631205585a.32.2026.07.27.08.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 08:57:17 -0700 (PDT) Date: Mon, 27 Jul 2026 11:57:11 -0400 From: Gregory Price To: Breno Leitao Cc: Andrew Morton , David Hildenbrand , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH] mm/migrate: report RCU-tasks quiescent states in migrate_pages_batch() Message-ID: References: <20260727-kcompact-v1-1-bdfefddd6874@debian.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260727-kcompact-v1-1-bdfefddd6874@debian.org> On Mon, Jul 27, 2026 at 06:50:19AM -0700, Breno Leitao wrote: > migrate_pages_batch() unmaps each folio before moving it, and every > unmap runs the mmu_notifier invalidate callbacks. On KVM hosts > try_to_migrate() ends up in kvm_mmu_notifier_invalidate_range_start() -> > tdp_mmu_zap_leafs(), which is expensive, so unmapping a large batch keeps > the CPU busy for a long time. > > The loop already calls cond_resched(), but on PREEMPTION kernels that is > a no-op, and involuntary preemption is not a Tasks-RCU quiescent state. > > A long batch therefore never reports a quiescent state, and the > migrating task (e.g. kcompactd) becomes a Tasks-RCU holdout, stalling the > Tasks-RCU grace period for minutes, which is common at Meta fleet: > > INFO: rcu_tasks detected stalls on tasks: > 0000000055349ecc: .. nvcsw: 1157401/1157401 holdout: 1 idle_cpu: -1/56 task:kcompactd0 state:R running task > Call Trace: > tdp_mmu_zap_leafs > tdp_mmu_next_root > gfn_to_pfn_cache_invalidate_start > kvm_mmu_notifier_invalidate_range_start > __mmu_notifier_invalidate_range_start > try_to_migrate_one > try_to_migrate > migrate_pages_batch > migrate_pages > compact_zone > compact_node > kcompactd > kthread > > Use cond_resched_tasks_rcu_qs() so a quiescent state is reported even > when cond_resched() does nothing. > > PS: This has also been discussed at [1] > > Link: https://lore.kernel.org/all/amdWVTs0WKOxguxP@gmail.com/ [1] > Signed-off-by: Breno Leitao Reviewed-by: Gregory Price