From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796201231; b=CsKljmVvr4TJrm8ppmG3ZYJAiPDQItK69F1Q8exJyudrg1ZuPX3sargPfplLz7V4CUrO ccf3xPxzLTRZYfUEcYf604aAHh9sluziaGJJPRPZCaOgtv3tUDG9UWfQnDJDW5YM/J0eV N8geBxvLWihtVcG1iqG2dhW7aj6HyTzPQ9VxbacfIswthzFnINLgaQl6qCajf9GQxjYp1 ouFucaZEpy24iRBgGqbaomv4KwR5ZqeoVmyjSurHdATDEBVuj113hGxisNseK++xyOCWZ FJn5e/EcaU2aUYTuUMXX+EYKBk5/SFhPegh8BWPkgf1ZUAG+4x/Kzakob7KC1CcHfnQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201231; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=avR2rJ/bR9/YXe3hCNiXDDixQMOEO4SR/eaFDUyKjvs=; b=Okrf984zcvuLzaHpxbfTqijENZ9VmHEm+JX96lVdo5Du+oNwo3iXcHbX8jOYVMri6MVF 3zb9Pdfbd2+h5SZC+qb20aq9AWrW4w1zACs6KJMyiodQrfRywaB3ZCHaIAPgu0xkFmdp9 40qBJmEJOJl5D6tWKAH8du2WQQCtaOyRTcUU68CW4y0tl0gJjdI5ZLJ7gVtPgbtprRA/x ID+PUd7Txbvx6NZcDnzDd1kPhyZ1N9qib5rIBsIz7MMZ3COAkEh6KLMObLLiWKi3lXmTN zX6uPvaMIGjRyJJSxq1mWqaVoXQUIz/SCt3C7W93vIP5iKS0tDhb00+YW7prKano+uA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AIGzXEu9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A908B606A331 for ; Wed, 2 Dec 2026 08:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=AIGzXEu9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 236351F0089C; Wed, 2 Dec 2026 08:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796201230; bh=avR2rJ/bR9/YXe3hCNiXDDixQMOEO4SR/eaFDUyKjvs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=AIGzXEu9awc+wC8kel5x9d3nqmEJsgHO3i0zQCzirJyjRvGvqtD9tP+5c8q7aOvpf bQu3dkgi62lqhUrRjS+QSBDzb025XvGA203d0GTXB3QVLkpORtQnah3bjrxGDvOH9H FgPhBAOtS0ptSENdLbwqgpehSUXe1mOHy5bdk8VdrGVTGJOSRwlM2U5el99yFyBuJr gYps5pbszs/m3RfaQUT5ykw7EArE263Co10+eXrgJGc2CyC96uWceZskqs018Coi1e 3z7Va6SFcsVAfrF0BQnLFspEbieyl4lsWDa5k890ExSPHuJ/MmKzo4WlD5CGp20gTA k5QIkmJqQu+mg== Date: Wed, 2 Dec 2026 10:47:04 +0200 From: Mike Rapoport To: Amir Hosseini Cc: akpm@linux-foundation.org, edumazet@kernel.org, davem@davemloft.net, brauner@kernel.org, muchun.song@linux.dev, linux-mm@kvack.org, netdev@vger.kernel.org Subject: Re: [PATCH] mm/mm_init: don't shrink large system hash tables below low_limit Message-ID: References: <20261201182438.2672909-1-me@amir.fyi> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201182438.2672909-1-me@amir.fyi> On Tue, Dec 01, 2026 at 06:24:38PM +0000, Amir Hosseini wrote: > On Tue, Dec 01, 2026 at 04:55:03PM +0200, Mike Rapoport wrote: > > Since that table is allocated in an initcall why not simply replace it with > > kvmalloc_array()? > > Good idea, that's much simpler. I tested it with the same fail_page_alloc > setup and the crash is gone. I'll send a patch. > > > You are right that the loop should respect the low_limit, but the entire > > alloc_large_system_hash() is quite convoluted and I believe it requires > > more drastic refactoring. > > TCP is where I hit this, but UDP depends on low_limit too. > udp_lib_get_port() keeps a bitmap on the stack that assumes at least 128 > slots, so if the table shrinks to 64 it writes past the end. KASAN catches > it on a bind to port 0. This is very unlikely in practice. I can send a > small patch that just stops the loop at low_limit, unless you prefer to > fold it into your cleanup. Yes, please. A small patch can be backported, a larger cleanup can't :) > Thanks, > Amir -- Sincerely yours, Mike.