Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TasJ7Xcp" Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDCC1AD for ; Fri, 1 Dec 2023 08:32:07 -0800 (PST) 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=rVH172bDylofEvt+PPOvzgtupGiUqOptYr0OBZTEWgk=; b=TasJ7XcpLBbpP2V/MdptDBE1JV ela05ld9MHlxOxAQHBe//t/2oTPBSITve715u/CwI5DARS9PTxxPfkLTfKDHvMB9yJkhX5PCx/d7p tRMyj2q6XGsUr6VjOxFhCJ8YW6j+uNDtMdaUUzhI5S09PCx5dlHm2cbKR2OXpY6J9EsSPyXO/zXg+ Oh5CuPvVwnHhYHjIvjlIEwKVoVnEAmaSyiPxM51ugNDNA1Kkj1ixtZq0d1KD7ilrJOxuHtJjei+gt 21RGAzQRLS65Hk5YVodlp8ak7RWn/Hhhc9k+PeBgaoVh7QSAw1nScYhOm0TXcDzEJ7tUDaErX8X/n ZkXdICiA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1r96Qu-00FgVD-Ox; Fri, 01 Dec 2023 16:32:04 +0000 Date: Fri, 1 Dec 2023 16:32:04 +0000 From: Matthew Wilcox To: Ryan Roberts Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1] mm/readahead: Do not allow order-1 folio Message-ID: References: <20231201161045.3962614-1-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-fsdevel@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: <20231201161045.3962614-1-ryan.roberts@arm.com> On Fri, Dec 01, 2023 at 04:10:45PM +0000, Ryan Roberts wrote: > The THP machinery does not support order-1 folios because it requires > meta data spanning the first 3 `struct page`s. So order-2 is the > smallest large folio that we can safely create. > > There was a theoretical bug whereby if ra->size was 2 or 3 pages (due to > the device-specific bdi->ra_pages being set that way), we could end up > with order = 1. Fix this by unconditionally checking if the preferred > order is 1 and if so, set it to 0. Previously this was done in a few > specific places, but with this refactoring it is done just once, > unconditionally, at the end of the calculation. > > This is a theoretical bug found during review of the code; I have no > evidence to suggest this manifests in the real world (I expect all > device-specific ra_pages values are much bigger than 3). > > Signed-off-by: Ryan Roberts It's better code anyway! Reviewed-by: Matthew Wilcox (Oracle)