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 C25DA21CA0D for ; Mon, 20 Jul 2026 22:16:33 +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=1784585794; cv=none; b=O6UP8CISfa7lX4mjaDwK2zfsU2qYlTGlRelSGhWg8epzP/Q9B+ITf9w5sKUL8cDCr78YgJqwtpWHLvpbLNi30ryaHh1YkdJuLFRNMn2pevOb3oTNBjhN9oQMSo8XcwpdGcvjLUEP9QMj6jOFYjZDA6KwRQK/B3d7kRK1ZMBrs2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784585794; c=relaxed/simple; bh=rzmQdn9KjOpQQK7AoHicT4mdJnrK5CnMdQlMxTpH4Fg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c4KW0b1thJ8r5B6MsF4JO//I9cP2uS3Rxv9Z9TqHesV1yLFQOet7K8EfwT6H4cWQJtseHDK6FQg8oi1bxxjzAHwS5kva8V/Qhlu5xGJN0K4SA+cgb+Mgu7euE14MI2eeUWxB3Ytvw5toyKBC2SPy7MiCGfz9E6LosXztnPCIO/Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NAT4xJHq; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NAT4xJHq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB9851F000E9; Mon, 20 Jul 2026 22:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784585793; bh=8DU8obaCw0iTM7IFbaaxyEJABTOe4jgbs0pWKQlHlMA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=NAT4xJHqv/vfaFe9m1w9iNPwcaMKlEUIvqtLY6RvG6MVhwXPAJ1XmQih2fV21NpUt MEbuKTBqvw7PsgiKE/xDXbwvU6oPvjiqbinaI4TbkDbrwej1DFCskK3BX2i3W1GBPz cEmNLNXk+N7Jkmi6vszHvmu70jFH5T2Dcw7SpjbRI7MueIyrTrTZo+q3itraQhEN/Q f3p6+voUWojJsA7wdMAmuycCxX16UCJUAHSI5DISp+SCwgyHQ2mfhg0yYnUWFbG/+w 32ASHFNn0kzmmXTE/1Sb/C2pqUla5slcBEfnZ4CyGSUhALQS/+g+9z4FE+ByS39weW m685xUvxDOnxg== Date: Mon, 20 Jul 2026 15:16:29 -0700 From: Dennis Zhou To: Zi Yan Cc: Tejun Heo , Christoph Lameter , Andrew Morton , Christoph Lameter , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sashiko Subject: Re: [PATCH] mm/percpu-km: fix bitmap overflow and accounting in pcpu_create_chunk() Message-ID: References: <20260709-fix-pcpu_create_chunk-in-percpu-km-v1-1-1f64745a84cc@nvidia.com> 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: Hi Zi, On Mon, Jul 20, 2026 at 03:20:31PM -0400, Zi Yan wrote: > On Thu Jul 9, 2026 at 3:12 PM EDT, Zi Yan wrote: > > In pcpu_create_chunk(), nr_pages is the total contiguous backing > > allocation, i.e., nr_units * pcpu_unit_pages, but pcpu_chunk_populated() > > uses it to set chunk->populated, whose size is pcpu_unit_pages, bitmap. > > Since bit N in chunk->populated means page offset N inside every unit is > > backed. When nr_units > 1, the function writes beyond chunk->populated. Fix > > it by using chunk->nr_pages. > > > > It also fixes the global pcpu_nr_empty_pop_pages accounting, since > > pcpu_balance_free() only iterates up to chunk->nr_pages. > > > > Commit a63d4ac4ab609 ("percpu: make percpu-km set chunk->populated bitmap > > properly") introduced the bitmap overflow issue. Later, > > commit b539b87fed37f ("percpu: implmeent pcpu_nr_empty_pop_pages and > > chunk->nr_populated") added pcpu_nr_empty_pop_pages and caused the > > accounting issue. > > A gentle ping on this patch. It would be great to get some feedback. > Thanks. > Sorry, this is right and I missed it years ago. Acked-by: Dennis Zhou Thanks, Dennis