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 D9B2F34AB0B for ; Fri, 16 Jan 2026 04:41:06 +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=1768538466; cv=none; b=qlnnrXW2DMLVPYQRJtAAF94D6UcmMA4sq2TYtMQs2itY4DCbcZnrp3V7eTCe9fOgMnAvsuiBS6NEckQR/UlsQ+dcYSlKsXzp5qZgIwIKCjtnvAd+7WtJelWglouGiEVZ57+y/zTLuuL8hF1ZXCNriqQ+Y80e+C4yvSaMdsaXm9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768538466; c=relaxed/simple; bh=ZpX22eDLuTWlfJ8zNQ8HMDTydSL8IN69+Vb9901rPJI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tNsbBD5dwou1xNzoSI1FjnhSF1xz06ugql4Lwce/Qa1I682M1/RkByjpohPZ06NFAxcLO+rq4dOkQspyFLpRoqCNBt2/9RerPo06x53pr/eRiEjyTu6ChZNyhXWv2KqfqRwJybS8XI6s5u80MsmTs6hB3jF+W2BQzhyUt963Ko4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kL1nLktg; 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="kL1nLktg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5CDC116C6; Fri, 16 Jan 2026 04:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768538465; bh=ZpX22eDLuTWlfJ8zNQ8HMDTydSL8IN69+Vb9901rPJI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kL1nLktgpPSzsoZkwKWH3GeDy7wYPC21Oo5Rfw6Lo7zSaJ/w1EP4VjBbcTkDEZO8j 3HdKlwpvaovQqSM81fyFkVPNczcO/kfAFaS6gV9te0MIERnOTLmyMg8DqKWywfVg/9 rDVjaAqCwgD7vBbrt1sNDgz9JYc7qbDkpi3WBEPr8qW8l2Ho8OnNUZGc2yzwNa7NMj f09F3KrlLMVpPDEMeKEewJ/SfMci4K6TRiwPWUm9khhCJEXfln9mcgmg5jz8dmOBOq Lc1SQQbGXNX61tPpRDgQp0HMjT8PN7CVOQFKuXSab4AhlQGfAMLQH37lWR7MUw9Buz mamjg+1UBgElw== Date: Fri, 16 Jan 2026 04:41:03 +0000 From: Jaegeuk Kim To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org Subject: Re: [PATCH 3/3] mm/readahead: try to allocate high order pages for FADVISE_FAV_WILLNEED Message-ID: References: <20251202013212.964298-1-jaegeuk@kernel.org> <20251202013212.964298-4-jaegeuk@kernel.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=us-ascii Content-Disposition: inline In-Reply-To: On 12/03, Jaegeuk Kim wrote: > On 12/02, Matthew Wilcox wrote: > > On Tue, Dec 02, 2025 at 01:30:13AM +0000, Jaegeuk Kim wrote: > > > @@ -627,7 +628,7 @@ void page_cache_sync_ra(struct readahead_control *ractl, > > > ra->size = min(contig_count + req_count, max_pages); > > > ra->async_size = 1; > > > readit: > > > - ra->order = 0; > > > + ra->order = mapping_max_folio_order(ractl->mapping); > > > ractl->_index = ra->start; > > > page_cache_ra_order(ractl, ra); > > > } > > > > I suspect this is in the wrong place, but I'm on holiday and not going > > to go spelunking through the readahead code looking for the right place. > > > > Also, going directly to max folio order is wrong, we should use the same > > approach as the write order code, encapsulated in filemap_get_order(). > > See 4f6617011910 > > It seems the key is page_cache_ra_order() which allocates pages by > ra_alloc_folio() given ra->order. FWIW, madvise() and fault() readahead > takes page_cache_async_ra(), while fadvise() takes page_cache_sync_ra(). > And, the former one has a logic to bump up the ra->order += 2 by f838ddf8cef5. > I think it'd make sense to match that behavior? Comment by any chance?