From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B7B2C4167D for ; Mon, 30 Oct 2023 16:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233908AbjJ3QrU (ORCPT ); Mon, 30 Oct 2023 12:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbjJ3QrS (ORCPT ); Mon, 30 Oct 2023 12:47:18 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5DA98; Mon, 30 Oct 2023 09:47:12 -0700 (PDT) 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=bIhF2shbU9yQ1xXu88DNW/2t71hPJ3iaMiPIW4OxDQA=; b=RIoSIG7WggABdOi0WX4MY6rASx WEinxOItdKlCxZt2IY5dzNeQIrQl3kumM4SkUssTiyTgpyXbZe2fjl8Obs29AVsEn+nkh9hGAVYBr OyALFWPiJZa2I1sjJcW6ciJlfTTD3xRqlVe1CSeL6/EJ7kbyvEUMdpvwHdB4/p+QZ6Wtsrse4CtfU 4Mik9G6cO0xGU1ndKSieed3xTVVvWrJggwrbK2//5SbANhLriTGgCyENp1XFAyzuf8XANqgxiS2As JmvZpN+OIMpOccqV4T9OBzH15eZiWFqQiaHB5w7Wcp8SiXQ+806Y0o77G8n6JSwY8VCNffQk+g9d+ K3K+gLzw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qxVPu-005A7k-4n; Mon, 30 Oct 2023 16:47:06 +0000 Date: Mon, 30 Oct 2023 16:47:06 +0000 From: Matthew Wilcox To: Youling Tang Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tangyouling@kylinos.cn Subject: Re: [PATCH] readahead: Update the file_ra_state.ra_pages with each readahead operation Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 30, 2023 at 03:41:30PM +0800, Youling Tang wrote: > From: Youling Tang > > Changing the read_ahead_kb value midway through a sequential read of a > large file found that the ra->ra_pages value remained unchanged (new > ra_pages can only be detected the next time the file is opened). Because > file_ra_state_init() is only called once in do_dentry_open() in most > cases. > > In ondemand_readahead(), update bdi->ra_pages to ra->ra_pages to ensure > that the maximum pages that can be allocated by the readahead algorithm > are the same as (read_ahead_kb * 1024) / PAGE_SIZE after read_ahead_kb > is modified. Explain to me why this is the correct behaviour. Many things are only initialised at open() time and are not updated until the next open(). This is longstanding behaviour that some apps expect. Why should we change it?