Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp523383lqp; Tue, 11 Jun 2024 11:05:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPE1U5022Rm2jlKgR10qrco/P1JbJdsg53lQ8PZfwDxzT0T1X/LdqJkLPtFtm5//bk5e4rycJAaDUe+idOGwcd89Vchnh79/Bd2PzYhA== X-Google-Smtp-Source: AGHT+IH+ypeejQtzDxjo7Kdu5V1W2r8uj43A5jGIeEChPXiXMt4dn4Fln1ionxU7BWCZ+TBmCbhQ X-Received: by 2002:a17:906:1754:b0:a6e:b5f0:70a2 with SMTP id a640c23a62f3a-a6eb5f07164mr785058466b.29.1718129103147; Tue, 11 Jun 2024 11:05:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718129103; cv=pass; d=google.com; s=arc-20160816; b=I9QvcSuhaLwPqwUi7/6snY7MwULGvKvgWdCPdr4xtNjOLpCZ6V2nhdPy/+KoLwZqUz XsUs+IS60kZYOtyGMa3dyDU9bjipa+wHWHqLfbVvh/0clJpA88YqYbGmdWpXjJb9zg7U 1blZyiPX/5PbssvI/DOEiAKDnHwSEbquEIffjvjQByGvKwt794c9ikEqaC8nNMetiV0N CAWrBOwb5O1EtvbsSXC+ya8bBSvdwBM3GnMFNKJev/l4PduGXHe/FAtHOFz2laWyNxGe Et8M1fkzjJaMcKOH06CCfPXYIlloCJFGDbxaROtmSoeZKS1Fu3su0n+8+bNBxviZkZUu T+uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EKRPx/5e30QjM78Bp1bs9Bf04T9QRk5msSWXRd/SGY0=; fh=z/C2W1h/lRLVkpDTxdetkpx8TI2461mpUG6675s1ryE=; b=yAfvFqXqKrtonQNBBsU+JMuNBgMXmdRUk5npmvyp4muoA2OK3mir2rVhM6UvXR612e QcCV/KMpdIUpluzpZ2hu8xZIKd6NRqrMfiCJbCUT+khXLJXpqMDLf+xCLUc3onNpJsym Xv1EGiNU5DMn+tgDupe1NuYkDCXhcK13XBHWiTmB68PKEn4gyu5Nx1y5Ebw8btScY5BK jDf5b+Gq424k/mIXbY20BvZV9CDRcN65p5wWAfkUyGhSJf94vUOwyvbUiooPGvRYncxE eJ7iitByONS+Ltfe/09dSyh7/20brgjZgcR+qY0jSGeepkLn4IHIWyJYT3Uv3/ENVUGv TTwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bmniwLSp; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-210396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210396-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6effe74816si369723966b.1036.2024.06.11.11.05.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 11:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=bmniwLSp; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-210396-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210396-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A57FA1F24AD2 for ; Tue, 11 Jun 2024 18:05:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 406F773473; Tue, 11 Jun 2024 18:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bmniwLSp" 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 D40FD482D7 for ; Tue, 11 Jun 2024 18:03:32 +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=1718129014; cv=none; b=QriPedAFEZvjaKWsvHZkkUgMEhzdt6UfWn+hsUSkmjQGndRbgYHfioZnI9ReKQDU1zXlK57Tf8JKennow9RVzIb4UxoRYEnUPpKZWGnbJTBcCbXq4WI3MjMkO+ma4GCWr2WsGexOK/sP7iykGkVswF8hmuBQ/4xfCZ88/CQArzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718129014; c=relaxed/simple; bh=IHVC82MbvcFJnblh+nTRI+KDvlao5m55Q/mjLrrzV5o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eWXDy+7BJlHdwBKZlDuVhp0v6Oxf56o88bRJA+5f4bdWCEt+HAKU/ll0tHjQAR5izK2mvNlS4aq744HE1MeP+qC9Gx7KsZ8bIGs3Ru7rXksuHRU1o6XbR1YcJ80UFi5bhnzfpZLJUGlrPbKbaGm9B+Cppah0ZeoB39dfHamygYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=bmniwLSp; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EKRPx/5e30QjM78Bp1bs9Bf04T9QRk5msSWXRd/SGY0=; b=bmniwLSpk47muRNBaDHHzaTMK0 Sq+X8xA30x+fVqgNsGDqgNOEBFOTLyhPhIqv+84sMGfGJmrOQ+Ius4DsC2apeHZRpdQvQtR4Q3UOF DggiNGkLMkT65LpGQDrFmVEeXmKNcVz2RbnMEVS9Jq7tp2THQQVGE8aig9XSZTuOlSj+BefdOtg54 UO7ql7VmxZoyeAxOKsoQvpmWX2UdbsJ0X3mS4oA1GaBktmdVayCS+jsMD05pSlKvvg+k3E026zoEe 40wJqV8jIvOaENmVZmG3pCchqEKddxuE+1IbLuGLnVyhRajwg+0SBHGOxM6aIqxoUp9dWfMsrYcBh UNttY9Vg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH5qD-0000000Dvws-0d0l; Tue, 11 Jun 2024 18:03:29 +0000 Date: Tue, 11 Jun 2024 19:03:29 +0100 From: Matthew Wilcox To: Andrew Bresticker Cc: Andrew Morton , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/memory: Don't require head page for do_set_pmd() Message-ID: References: <20240611153216.2794513-1-abrestic@rivosinc.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: <20240611153216.2794513-1-abrestic@rivosinc.com> On Tue, Jun 11, 2024 at 08:32:16AM -0700, Andrew Bresticker wrote: > - if (page != &folio->page || folio_order(folio) != HPAGE_PMD_ORDER) > + if (folio_order(folio) != HPAGE_PMD_ORDER) > return ret; > + page = &folio->page; This works today, but in about six months time it's going to be a pain. + page = folio_page(folio, 0); is the one which works today and in the future. Of course, as I'm writing this now I'm thinking we could make this work for folios which are larger than PMD size. Which we currently prohibit (at least in part because this function doesn't work with folios larger than PMD size) pgoff_t idx = ((haddr - vma->vm_start) / PAGE_SIZE) + vma->vm_pgoff; page = folio_file_page(folio, idx); (there might be a more succinct way to write that, and I might have messed up the polarity on something). Worth starting to fix these places that don't work with folios larger than PMD size? I think it'd be worth supporting, eg 4MB folios. Current bandwidth of a gen5 x8 link is 32GB/s, so we can read 8,000 4MB pages/second at a latency of 125us. My laptop only has a gen4 x2 SSD, so a 4MB folio would take 1ms to read which might be a little excessive for normal use. Of course allocating an order 10 folio is hard, so it's not going to happen terribly often anyway.