From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92BFE2FB085 for ; Fri, 6 Feb 2026 10:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770372066; cv=none; b=lViLXjlH9R/jxPOXqYSzJZqDEtX7mV4RqxLAAYefygURjgPB1j8xMQruSoBoG25az5rAX0bGHerWNGIhsB9FYT0AqawzYvytxTmj7dd3Hm6MSEe60CjddSD+cjJGQCbEm44Enz69NT+JI1/IPjOCkbXTvtHt+q0bJVF/4rfBNQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770372066; c=relaxed/simple; bh=SS/I75z7oYhuNvKD6ygSLj5fvp0pNhf0sV+nD0a7oZA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tL7vV7cKYIZ2S/S4yRT37BO3ta1t03pC7ozI9hbHJwG2oM62NsO0QTrKPHTkRJmJRJ7uA1li32cKX8bznw3poo72NJx6VngEvYxv/yIlXy8VVOV4vRbq0TNrbzY7cJ430NDkZRjUrST5ScG57IqI366vHcgtaZtD2bfXTRjyBgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 10009339; Fri, 6 Feb 2026 02:00:58 -0800 (PST) Received: from [10.164.136.38] (unknown [10.164.136.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 591633F632; Fri, 6 Feb 2026 02:01:01 -0800 (PST) Message-ID: <15ddd3fb-abff-4a95-9670-06622bd90e1d@arm.com> Date: Fri, 6 Feb 2026 15:30:49 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH mm-new v6 2/5] mm: khugepaged: refine scan progress number To: "David Hildenbrand (Arm)" , Vernon Yang Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, ziy@nvidia.com, baohua@kernel.org, lance.yang@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vernon Yang References: <20260201122554.1470071-1-vernon2gm@gmail.com> <20260201122554.1470071-3-vernon2gm@gmail.com> <85e8ded9-a9eb-4663-9c96-93af60006fb6@kernel.org> <9508744b-e5d5-49ef-825f-eef683892541@arm.com> <1a6d8295-e27b-4440-a367-af0432a7af4f@kernel.org> Content-Language: en-US From: Dev Jain In-Reply-To: <1a6d8295-e27b-4440-a367-af0432a7af4f@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 06/02/26 2:32 pm, David Hildenbrand (Arm) wrote: > On 2/5/26 15:25, Dev Jain wrote: >> >> On 05/02/26 5:41 pm, David Hildenbrand (arm) wrote: >>> On 2/5/26 07:08, Vernon Yang wrote: >>>> On Thu, Feb 5, 2026 at 5:35 AM David Hildenbrand (arm) >>>> wrote: >>>> >>>> I guess, your meaning is "min(_pte - pte + 1, HPAGE_PMD_NR)", not max(). >>> >>> Yes! >>> >>>> >>>> >>>> I'm also worried that the compiler can't optimize this since the body of >>>> the loop is complex, as with Dev's opinion [1]. >>> >>> Why do we even have to optimize this? :) >>> >>> Premature ... ? :) >> >> >> I mean .... we don't, but the alternate is a one liner using max(). > > I'm fine with the max(), but it still seems like adding complexity to > optimize something that is nowhere prove to really be a problem.  Agreed. Vernon, let us do the increment in the loop then.