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 CDD76286891 for ; Wed, 11 Mar 2026 04:54:35 +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=1773204877; cv=none; b=gYHgcTIJb9kAwdSWSe624z5QcXl4rSqpBX3mCG69qOZulkkf8DzHNN6YqLZoyIjfvMwHOMVRd6SbEOR4M8YnZlYq8r2EhW0LqEr59mrzBxxwkaJFUWSHg7PYb2LmHaKqDbOxoOP460Guhnd8IMRmIlncu2XEviyqSL2r4QaA0Go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773204877; c=relaxed/simple; bh=cnkoSZzMid3MZQR5X/Bpy1pfjp39KWAA+82ylcUNCwo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QAsh3ZivLi4ZjVlVqG9x6FAuSmNhmm4PO9LQAdaoTmxGFNpTT/ksrpNhk5YnLLOQ1IeHZzOiEHPljzbi06JFJjDwsuEoy13lGEkeAyiPyhPrt6pwZaEPr7QVleBapfYff+HsYIO1kvYYQ133UHIUDHtAGYcgaqg0oZximAtUfvU= 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 012A5165C; Tue, 10 Mar 2026 21:54:29 -0700 (PDT) Received: from [10.164.148.48] (unknown [10.164.148.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BEF5D3F73B; Tue, 10 Mar 2026 21:54:25 -0700 (PDT) Message-ID: <5de784bd-d9f9-4331-9e20-6e50f6510e3d@arm.com> Date: Wed, 11 Mar 2026 10:24:22 +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 1/9] mm/rmap: make nr_pages signed in try_to_unmap_one To: Matthew Wilcox Cc: "David Hildenbrand (Arm)" , "Lorenzo Stoakes (Oracle)" , akpm@linux-foundation.org, axelrasmussen@google.com, yuanchu@google.com, hughd@google.com, chrisl@kernel.org, kasong@tencent.com, weixugc@google.com, Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, riel@surriel.com, harry.yoo@oracle.com, jannh@google.com, pfalcato@suse.de, baolin.wang@linux.alibaba.com, shikemeng@huaweicloud.com, nphamcs@gmail.com, bhe@redhat.com, baohua@kernel.org, youngjun.park@lge.com, ziy@nvidia.com, kas@kernel.org, yuzhao@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ryan.roberts@arm.com, anshuman.khandual@arm.com References: <20260310073013.4069309-1-dev.jain@arm.com> <20260310073013.4069309-2-dev.jain@arm.com> <21801fb7-0f42-4ad3-8b85-2ac6013b8aa5@lucifer.local> <31f93292-3de6-475c-b7fe-82ef41a3a7de@kernel.org> <04a7465b-ee69-479f-aaa4-ccdf3ae16805@arm.com> Content-Language: en-US From: Dev Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/03/26 6:10 pm, Matthew Wilcox wrote: > On Tue, Mar 10, 2026 at 01:53:21PM +0530, Dev Jain wrote: >> So when I was playing around with the code, I noticed that passing >> unsigned int nr_pages to add_mm_counter(-nr_pages) messes up things. Then > > Using int (whether signed or unsigned) to store nr_pages is a bad idea. > Look how many people are asking about supporting PUD-sized folios. > On an ARM 64k PAGE_SIZE machine, that's 2^26 pages which is uncomfortably > close to 2^32. It'll only take one more level to exceed that, so, what, > five to ten more years? > > Just use unsigned long everywhere now and save ourselves the grief later. Thanks, let us do this.