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 A62C226E714 for ; Wed, 3 Dec 2025 19:04:50 +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=1764788690; cv=none; b=ul99lGbyo7QJfA5f2h0SyRuuevb5XAwibx8s3VL6E4dm/9hYi36Q3/Qxm8q6bTjPn0tvRPuGr1ifFR1KQ/O47s59Qc+rKcUxYs2Kdjeg/B9jvCi2GZvDEVT7wWt/kAiuQYF0SG4UQpo6Xtx4uOAkA096MozbmCTKCi8r2hgXCbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764788690; c=relaxed/simple; bh=aGzbRJbeT3IOWtWgKv9SQeyNm/6DptS3SWAhcU/89oM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WGRVPnEWiT3XCX8aOw4EGmX6aZYnhvhKeYzizA8GFau7dvvcwpUa17pHRh5DRJxJHWenrHSIQNkbEbbfuksGojziQKI6SwDgzai4foRez8dYtWXbA5hnLqlpVksXaFuAFvxsYoG9heH+kSkTPuvbZP6zPAcoxTtfpP8vs+zih2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eZAsd+ui; 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="eZAsd+ui" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1386C113D0; Wed, 3 Dec 2025 19:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764788690; bh=aGzbRJbeT3IOWtWgKv9SQeyNm/6DptS3SWAhcU/89oM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eZAsd+uiYiYijRM/xndKWYV/dH/Ysd8e6EGy32Ezg5DJnhjZP0auJVPTpr1Rx6PWi nkJQ5sFfxsdhhHmX5p/kWicdMjuwqody2RxrzcUYpM/Ang7BJToUQfmvlPnmsS+Z5x 3z7Y9aztneDJbGimGlAT5vLYCKFKDhar33VyOnS10ElJBiPkFRzeX/NFPCi4nrJUYs X9lvlQjGsbWDjYlZrLUi8TJSQDbaacDjmVEhwZA7UYAXbeKLRJXno5J1mZZTJCJaKW jAKTpD2hZz6YVfLbfbpI/TukHoD9tqawayqTdawOGonDc9o57z5jIyUcu6bt++D4Fi 5K0SNhq5gBMSg== Date: Wed, 3 Dec 2025 19:04:48 +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/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?