From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 26E103115AE for ; Tue, 18 Aug 2026 18:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787077079; cv=none; b=RbKEnnYwjxLBBCckTjBhPWG6SY+qflZGBiPc8zCzoDjvShBDlQGAowO6Igb56dgrK0oRaTJhhfqexjROgSfDJEN3tQY8kUBB8KN5gTORp2H8T6aYEI9HKclPTyAigB3cv1b5Fv4OND7GBtJFU0OwHRmInuMTEYADEW0x/YMspaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787077079; c=relaxed/simple; bh=W8cmWBdw6nqaYDVaFZhnJVvuIpLeIZC6fh8yxzCshz8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=UK7kJ+jArbpzBV6e4/E4dAIJ8XHN/BWwbBCkaKSndF03ypQxKlVrUlfbxfH0LEalI2OWU1tn7aQZdryG8ACEz1/tvCZ1Ssnm78tOclvAo48Yx22WYcTPFQBLj5rXHWJVCH6vf7jb0jstAe68QF3dn+lVkXTOw6bzhN65vqltDIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=S2zmJSA4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="S2zmJSA4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 823401F000E9; Tue, 18 Aug 2026 18:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1787077077; bh=wL0CkUQJGJiUfrjRhTdtW4GRwxEsV1avXNEQy1O+5d4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=S2zmJSA4hi3L+3w/nGghnBtGmVPaXy1n40HH+CptFgaKpNEYSzKTLJhNEz9xcvxZO G56ejIVOfp4brGi/l9Vy+1hJTs5AYrncx+9CUThq9ra+t6+KmmGE3UIsaYaGC2wtbp OfumQjHR52PJnEZCxP7EuUyFaHkrRc44R/+Z0fNg= Date: Tue, 18 Aug 2026 11:17:56 -0700 From: Andrew Morton To: "David Hildenbrand (Arm)" Cc: Leon Hwang , linux-mm@kvack.org, Muchun Song , Oscar Salvador , linux-kernel@vger.kernel.org, Lance Yang Subject: Re: [PATCH] hugetlb: add cond_resched() to __unmap_hugepage_range() Message-Id: <20260818111756.6b0e347db3170bc22cc3c5af@linux-foundation.org> In-Reply-To: <3dadebb3-7e2a-459c-a5e8-b375faf89938@kernel.org> References: <20260818135029.93288-1-leon.hwang@linux.dev> <3dadebb3-7e2a-459c-a5e8-b375faf89938@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 18 Aug 2026 16:23:29 +0200 "David Hildenbrand (Arm)" wrote: > On 8/18/26 15:50, Leon Hwang wrote: > > Packet receive timeouts were traced to sparse HugeTLB unmapping in > > production. A task unmapping a sparse 2.5 TiB HugeTLB mapping could > > remain in kernel context for over 40 ms without reaching a scheduling > > point while walking empty huge PTEs. Although hard IRQs could still be > > handled, the per-CPU ksoftirqd thread and other runnable tasks could not > > run during that interval, delaying NET_RX softirq work queued to > > ksoftirqd. > > > > Add cond_resched() at the beginning of the hugepage loop so ksoftirqd > > and other runnable tasks can run between iterations. Testing with > > PREEMPT_NONE showed that the maximum interval between scheduling points > > fell from over 40 ms to below 2.5 ms. Total time spent in > > __unmap_hugepage_range() remained about 36 ms. > > > > Reported-by: Lance Yang > > Tested-by: Lance Yang Is there a Link: to Lance's report? > > Signed-off-by: Leon Hwang > > --- > > mm/hugetlb.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index dded1768193a..0a91aac2369f 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -5233,6 +5233,8 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, > > last_addr_mask = hugetlb_mask_last_page(h); > > address = start; > > for (; address < end; address += sz) { > > + cond_resched(); > > + > > ptep = hugetlb_walk(vma, address, sz); > > if (!ptep) { > > address |= last_addr_mask; > > As Michal just put it: > > "PREEMPT_NONE is effectivelly dead and most cond_resched will/should be > removed. Is there any reason why you are not using full preemption when > requiring low latencies?" > > https://lore.kernel.org/r/aoRnUxUlgf_kRlm8@tiehlicka That's pretty bad behavior and we might want to fix it in earlier kernels. Is PREEMPT_NONE effectively dead in 6.18.x and its existing users? If yes, we do want to fix older kernels then we should merge this.