From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 626A540DFC4 for ; Sun, 22 Mar 2026 11:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774177302; cv=none; b=jEEutWErn2iKpPVWN2R5hTuS9M5Ckn9WfE+aswHaiuJsjTBXjuHE6JqAe0NuxHVq8MpqwPQl5U0HNY0d559XNQ/4P3ZV8WBVI+7FDvaZPhBWB78JAZAVj0dV2sizDxJ2KKCNUdn/f1F93e3VTQXblqcuF8GRhG+fdL079dGyL44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774177302; c=relaxed/simple; bh=tC01ybyDA573d5o3Uy5N5ehRgFq9mu0hsXd3ZX+WARM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q0K+oCUlAA8kx8/oGQ1a4ROV2Nk17opNC+vGaJZGoE/k934TZu1HyAeXwh/iOXMUx9+HOCDoz1gs+TjGiG7nTaesthZ4J52MmCA9WSM3TMC8fQCZqBVXqod5w43YA7SrBjQOAWlz21YOtPpvh2xsWGAMmbYX3BgZH3fp+T8J39U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EiOv9hi4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EiOv9hi4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0D3AC19424; Sun, 22 Mar 2026 11:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774177302; bh=tC01ybyDA573d5o3Uy5N5ehRgFq9mu0hsXd3ZX+WARM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EiOv9hi4CjxJHl05f87A+5TVs7u/sO2FITeu5sj53f+LQoZl+i5IpF4Or7APrW4NS BDbebIaH4c6oQ0dDR6iurDyKo6MwLpPPbsmaPaI+czl0OL8JmYbZjtn2qbWH+p+GBA 7ywYP0UPRILvaqhVLWKWFtm68ZsdV0NKRdDDTHKKXx9tWl09AKcX8lLd+hiemrVR6G 0mY4faQ4ShH37ezOapTDk8NaCN1hIk9wODkRH4FOtDq0dq/XPt2UYl4yP1p0Zx15so H7RTyBsccQioWHEcs1sQ3n+lQzJ1y8SWBPjuibORjlMGDmeixuHoGZ4oROZdYpLUj9 ZVlp80xtcNVFA== Date: Sun, 22 Mar 2026 13:01:35 +0200 From: Mike Rapoport To: Hubert Mazur Cc: Andrew Morton , Greg Kroah-Hartman , Stanislaw Kardach , Michal Krawczyk , Slawomir Rosek , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] mm/execmem: Make the populate and alloc atomic Message-ID: References: <20260320075723.779985-1-hmazur@google.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: <20260320075723.779985-1-hmazur@google.com> On Fri, Mar 20, 2026 at 07:57:23AM +0000, Hubert Mazur wrote: > When a block of memory is requested from the execmem manager it tries > to find a suitable fragment by traversing the free_areas. In case > there is no such block, a new memory area is added to the free_areas > and then allocated to the caller by traversing the free_area tree again. > > The above operations of allocation and tree traversal are not atomic > hence another request may consume this newly allocated memory block > which results in the allocation failure for the original request. > Such occurrence can be spotted on devices running the 6.18 kernel > during the parallel modules loading. > > To mitigate such resource races execute the cache population and > allocation operations under one mutex lock. > > Signed-off-by: Hubert Mazur Reviewed-by: Mike Rapoport (Microsoft) > --- -- Sincerely yours, Mike.