From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out198-8.us.a.mail.aliyun.com (out198-8.us.a.mail.aliyun.com [47.90.198.8]) (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 0628F283FDB for ; Tue, 25 Nov 2025 04:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.198.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764044802; cv=none; b=iUQ9fzrPJuxjZAkenusDv09QvOHa23r/H3yDbbEscR7ANGaqGHzKt1C7Xu4+DlY2rgWQDpiktfi7bDfxJ34v5QQHcas2iYTOfZkWZWOUg/JPsvpXbbhkPADB2dVkqwh0th7Ye9soJXuanH9tRixq9wRF6oIen7SNaZFYBTKipm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764044802; c=relaxed/simple; bh=i6LFbSRrIzwoOYvE2SZ/iuRmY7be0Pwdz+onjbFfWAs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fZ5bIh48kY3xyuIAkumy7WxyltpudUOb92dgwO2UMdAzCejUnOc3VAxhtyVx4bfWQnQ6AdSDNlhKI1EBIzf1dTY8JuAMZTJGzQlMi2+sofscgDnD8g3GY8Xp+ig5goCgs5SlN/aqmGnzwvVETAe0U/D4R/9QfdeOyxKHUVj88D8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=ZzKqzUuh; arc=none smtp.client-ip=47.90.198.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="ZzKqzUuh" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1764044782; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; bh=6HHebMJqUXHsz+vWYUyAkO0gwd19IOceRKxNgMJRA9E=; b=ZzKqzUuhDvY0YwudbEpovMnRMWBGIbB2nwRHXEEEBLayJbfPFFy7Ht+HC4OKmybB6bBNZHWYrOrp9LSSuFVLefF899FPN0jh78UJl+E8r2E6CGArwUCSkcwPxJWSbLzXJm677cwh9DC6ul0y6mddDZ+DGFmvlZ1lqrQMGdzqjwc= Received: from i85a15111.eu95sqa(mailfrom:junchuan.tzh@antgroup.com fp:SMTPD_---.fVFjKd6_1764044779 cluster:ay29) by smtp.aliyun-inc.com; Tue, 25 Nov 2025 12:26:21 +0800 Date: Tue, 25 Nov 2025 12:26:19 +0800 From: Zhiheng Tao To: Lance Yang 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)" Subject: Re: [PATCH] mm/khugepaged: Fix skipping of alloc sleep after second failure Message-ID: <20251125042619.GA119062@i85a15111.eu95sqa> References: <1763965157-58413-1-git-send-email-junchuan.tzh@antgroup.com> <0f292735-4b13-417f-bc65-82cebd2040a3@linux.dev> 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: <0f292735-4b13-417f-bc65-82cebd2040a3@linux.dev> User-Agent: Mutt/1.5.21 (2010-09-15) On Mon, Nov 24, 2025 at 05:27:23PM +0800, Lance Yang wrote: > > > 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? > Is it more appropriate to honor the second allocation failure? It was a problem before commit c6a7f445a272 when khugepaged_pages_to_scan=512. > > > >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 >