From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 50D962BE043 for ; Thu, 29 Jan 2026 00:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769647879; cv=none; b=fZWM2tfAP6QxVmPr4q6+1B4GE75lm1XZIODxhLhVX2U/jmDkRHAeu+EoJYqfognSCXUTDhI3inrxC1PralFNjaBQHwCnptN9XDAnzW0wYePsCtQnZlzDcbNw9E935cdwXUlMD6vVq0DYlI2uf/Ib/O1PeeDY9wTV1AwcVTz1Vzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769647879; c=relaxed/simple; bh=r4EeQS6He4hA409/sglUXLw9gkYhogR6mhZR362GOyg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=STYTnpOcl7GaGt9UrRn6lpZr/5oG8BaBoHv9YDZLXjEmW2sVozk0oqlKmw7xDIeKCmWk3No4nXVkvh6UofNXUkZYTQuFLW+aGRFw3dgrFC19dZZgOuUMMozP0e4OdmN2Iumuq/fVdPSuYmYjzyaYF+ur5Lfh8W1+THd6qq/UJpw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HAPXbs6s; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HAPXbs6s" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=L4AF41OoN6wLW3Ksx7JAVR5WN6Ag2lRG6vH9W603dug=; b=HAPXbs6s2IWE6aFzcSMFVOPGGx sjruUuR6CY9Tkjx5FJK2nuqwfY0Wzl2IljrOyBmn2usIZIOMcQyHUtNh+Pvuhx3iQNldFCogWMf2h FCcjY3qUu+8mWoF0c+j3uIYHTbOBiRJXM2mVL+dRYzO64Tkd17d6hJbZwwXYUXh87bAI2WtAR+vWq 4siZF0VvXeq2NKXo1hhRBoJT+Y2uBsIQBMDuB6q9kuTsefjMh8gA8dMGuU04hLOGSFG5v1ir2vPuB 4k1U0/JTmt4el78mf3TgwEbo274a5HtfJoRztmK0l7w43jxE+hhSxkVzuYSpy59/YvOeglsoY+Z3A 6lw+J3UQ==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vlGFX-00000009qHX-0RQK; Thu, 29 Jan 2026 00:51:07 +0000 Date: Thu, 29 Jan 2026 00:51:06 +0000 From: Matthew Wilcox To: Brian Geffon Cc: Justin Green , akpm@linux-foundation.org, linux-mm@kvack.org, david@kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, linux-kernel@vger.kernel.org, greenjustin@google.com, rientjes@google.com, arjunroy@google.com Subject: Re: [PATCH] mm: Refactor vma_map_pages to use vm_insert_pages Message-ID: References: <20260128225648.2938636-1-greenjustin@chromium.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 28, 2026 at 05:59:12PM -0500, Brian Geffon wrote: > On Wed, Jan 28, 2026 at 5:57 PM Justin Green wrote: > > > > vma_map_pages currently calls vm_insert_page on each individual page in > > the mapping, which creates significant overhead because we are > > repeatedly spinlocking. Instead, we should batch insert pages using > > vm_insert_pages, which amortizes the cost of the spinlock. > > This makes sense, I wonder why this wasn't done previously? That's always a good question, because it might reveal why this patch is a bad idea ... However in this case, it simply seems to be an oversight. __vm_map_pages() was introduced in May 2019 and then vm_insert_pages() was added in April 2020. Reviewed-by: Matthew Wilcox (Oracle)