From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 0067C2F60CB for ; Mon, 24 Nov 2025 09:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763976454; cv=none; b=khTVRcK82rEXDYzhSNrVOVzNFpMn1HrP0mMd5+46EL6kQ7eRl/v5pKbdA2Q/TrU/yw3veXa9K0KHslTs7IoIEAdk2I43HghV1pmKrbOZ+RHZWPSzomgPmAvy443OU3ufhrPez8CO6SIyc6hIOWnTO71PAapRoy5t2g+amh8VA7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763976454; c=relaxed/simple; bh=J/5/2/oPwm1h8Mx+J4NtX5jiJLY+oVf4AXYsaCxdR/w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ngIFbzQO66PMkUUYDUCP5bX/C6Gbl7arDI0sSPAtMEmF0vzh8JDLD8XA+vKRiL7ODUaZDMX7n0pPr6HuzRBLbvn5F66cH02/Qo5AVX+WHYbzsrzchNYaG2tCVcYMngzLgZYReUKW1sf7+6yjAojdDbZzbkaOapFuO+dT/eBmzzc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=X7nJ2UMz; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="X7nJ2UMz" Message-ID: <0f292735-4b13-417f-bc65-82cebd2040a3@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763976450; h=from:from: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; bh=bKk3rLELPtCaq6kSIZA6Ay0Og8Sjup640I4FGfHPm18=; b=X7nJ2UMzDJHfWZPxEov3YNED1bugp2p6Vp1qyvTPFJ0oXYrT9AKVJQpzimu8qNi35CPj9Q OAFP3YGNXwaDjxXq8uiNGscumIaaWgPPHFajoszsXAnaAKQqpRaDkDIM+TzwHtJJ5SEp8J xiwO/Ix4kH9Pyinf19KdM7TL+TZilQs= Date: Mon, 24 Nov 2025 17:27:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] mm/khugepaged: Fix skipping of alloc sleep after second failure To: Zhiheng Tao Cc: ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, shy828301@gmail.com, zokeefe@google.com, peterx@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, lorenzo.stoakes@oracle.com, "David Hildenbrand (Red Hat)" References: <1763965157-58413-1-git-send-email-junchuan.tzh@antgroup.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2025/11/24 17:14, David Hildenbrand (Red Hat) wrote: > On 11/24/25 07:19, Zhiheng Tao wrote: >> In khugepaged_do_scan(), two consecutive allocation failures cause >> the logic to skip the dedicated 60s throttling sleep >> (khugepaged_alloc_sleep_millisecs), forcing a fallback to the >> shorter 10s scanning interval via the outer loop >> >> Since fragmentation is unlikely to resolve in 10s, this results in >> wasted CPU cycles on immediate retries. > > Why shouldn't memory comapction be able to compact a single THP in 10s? > > Why should it resolve in 60s? > >> >> Reorder the failure logic to ensure khugepaged_alloc_sleep() is >> always called on each allocation failure. >> >> Fixes: c6a7f445a272 ("mm: khugepaged: don't carry huge page to the >> next loop for !CONFIG_NUMA") > > What are we fixing here? This sounds like a change that might be better > on some systems, but worse on others? Seems like we're not honoring khugepaged_alloc_sleep_millisecs on the second allocation failure... but is that actually a problem? > > We really need more information on when/how an issue was hit, and how > this patch here really moves the needle in any way. +1