Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2864576rdh; Mon, 30 Oct 2023 09:47:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTfugx5SsLqub3tqe5r1BQXqR3RINGW3zDQsNqXY+uaeImRgA6EknswF6NAMIpyxxWXPsJ X-Received: by 2002:a05:6870:9d0c:b0:1ea:9898:c07f with SMTP id pp12-20020a0568709d0c00b001ea9898c07fmr12946731oab.22.1698684442733; Mon, 30 Oct 2023 09:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698684442; cv=none; d=google.com; s=arc-20160816; b=NA0ufLMC0T+4fF1B2xyaXuMy8Oxdcj90VbAGklmzk6FnIFgEqrQ0qylq87nPOzyv99 Zl+hNHjOdXfiBqfObg5O4hfb5EY6vY1HrjVLQZ0aff0iQIyOoImSZsCKuFASR7CjwEUv Ow3yRky70usGtahanyUdLu8G4eVYRpPLOwYMsoRqwGkysnidYIrT8Q+8AgzVQXNmSHU5 lOHtTbqiS8Wt613aYm04b6WaRwGdXiHbEwthziAfISBmXHtuwr0FrIuwtGWhQe6mNWzG 8vAezmKDFSii+JDX0f+MsbuGEimJ2/3wdu67OK64zwX99baPZna4vvwMm2R5c1bEJKBr 6TYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bIhF2shbU9yQ1xXu88DNW/2t71hPJ3iaMiPIW4OxDQA=; fh=N7xxaUKhnR/iocnEe+elBe9lizCrUbIH/K7IKc6R764=; b=AOKvuDCGhEbO4Vt1ngzUiEf230rC8iaaPAJpE0gLKlbxTjRtGQf15ixBB2l4nlKJk+ CCvcH8NWASf1Vchwx3RZj41RYIm53+yeBI2iDsXNdIfeGG/Uq2amK0Xz3WJMKv5mJqZ6 dSTM/ELpEIg53qaaNSgy0HW3vSGBc4lFBWsBC1+zU3p/Ongdap7cyNqSgq3J5SHoeGhy /MeGBcioIItwVx2nwgeis/uafCQba77940z9pS2bU584Q2HzRtChk5lD6tAr7fILp4Li 6aYGtMRsqa8P468D/Uu/UYE6LgKF//TbaiqVTlpXVjNnkz6pcCwGZ7shlFANqJy3v9eC NDYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RIoSIG7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 79-20020a630152000000b005b837c29d13si5163040pgb.133.2023.10.30.09.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RIoSIG7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 597BD802F32F; Mon, 30 Oct 2023 09:47:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233878AbjJ3QrT (ORCPT + 99 others); Mon, 30 Oct 2023 12:47:19 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 09:47:20 -0700 (PDT) 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?