Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp67200pxa; Thu, 13 Aug 2020 19:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRXxpvPBf1k0lgbHOvwaAsjHdMwd8uN3xxmWmM8SCITrFG5JV+Jxpug+8y/SS3+91PkHoS X-Received: by 2002:aa7:df0c:: with SMTP id c12mr334588edy.60.1597373315637; Thu, 13 Aug 2020 19:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597373315; cv=none; d=google.com; s=arc-20160816; b=tgtTmsEwCk80ArDFbgtGfOajeNldg9eAnG9qRv1QEaZy4w4DtZXWBrB9dbOvnEiI+i 8ezlu770zCICIt3Isv68ZluhetkDkrooC3DpqaLvDMge3omV1MgP3hny/qORh/xdSrn4 BuXkMRr6X4hbrXo11nP7vpcpcKy1+wFidv6kL8LTx1+BHkAMhdQJ6A79uTSCK0U9lCk4 8oXB7j7Pp4l2gw5bXobyR6Ct1YhSbbTOSA87KNwF+vmPn9vjuOI0EFJHTWTGtYcNOJAe 3ZE92O9eygOo4F9U1UzFBypmSR/TSB1ZQCj7sFvbGFtcBVzvNFexaDP+jExTJG2KfJLU x1mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V67boQdxUh+EKnHxjdSvNlWThBzPWn7l76Hn+22xKwY=; b=n4MSxVDcBzMBryKFfYCF75UWggW54v6fip0isL0+l0QwhXm6l0Nqm8/YMgKIism0pe k0TLL0RHxIfrvbSrkCtPWwkXELjc70ZfjpDEam1AYAfscEgJ5wXWvugs2paXfDLc6Am/ /Ih+6Ak5K8RAzcPuLXw1GdiwMYd62NSnBeI0v2Vw6q0FsufgYMnwZ6JRFM5sCSNr9mJ5 V5e6KkdvxqORX74mTpzzAlZTYizDvAZ9k+gDox3tXNKSzKPBvXpBacKI7tercaU3vyj+ 3S5PyWhwkT4Ats4oJHmDssi+FY8GFcTyHtNGFiP9d+0nW9d4BY9ZPQDWzjS5HPiIuc28 LEwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iItyAXbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si4377453ejo.392.2020.08.13.19.48.11; Thu, 13 Aug 2020 19:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iItyAXbV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbgHNCpt (ORCPT + 99 others); Thu, 13 Aug 2020 22:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726568AbgHNCpt (ORCPT ); Thu, 13 Aug 2020 22:45:49 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 189E7C061757 for ; Thu, 13 Aug 2020 19:45:49 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id q75so9508680iod.1 for ; Thu, 13 Aug 2020 19:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V67boQdxUh+EKnHxjdSvNlWThBzPWn7l76Hn+22xKwY=; b=iItyAXbV4AtTVB/A1XLrODCdqoj3hNd0mtqFqafBesCMzP0JneEhDnMDeck0jmFAh2 VbAlECWw8BvsK7ymoeea0C3gUUroE4/gQy07gHiZoJbCTySpkZsgoB797bTGJRrr2uW/ fe6H+M45kvlp6amw/Zfd1DHOpKYCC1tXxgVbb/GsdcCfKkeMw6Ss8t++Ls6DO552Qfvm HJmwXyFdd1XzHCrxehmBr21bFd+81TrtHuotW0pBYhjBeNNzCdAsRLoftze9H9ld8i4Z sKvdLFvaNsIGnID//lsgKMq5yoO3LlOfh8+rxuASi2lcxpNUZnneJ2TuRZGM7aTPn4E5 VnrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V67boQdxUh+EKnHxjdSvNlWThBzPWn7l76Hn+22xKwY=; b=DfCbMaodXuDxaAW4zH5eqDbd1d440OFivCYfQXoprSDYX7x0QQYJcptpG+6yJ9TK7U 66H63U0VCX+QbFTtEspGuebjhVcayuVj4D16djfpcjf+fibWN5zmrl6/ciRqW9fr6eTu OLTmJoBd4Ttf90G2ScvIvipg1TQfxAAPr3o0OCBmwONiIL3u8vqB5+ybeapCu+4iDaAx RoxyzZyxP3x1RzCZDaIoKRJVyt5JAUSMSY8dbAtIyUfUcn1sVRHZB33wj3RHuH6HzUqe rZJ+eq6LxDefibav0XESlB2oCxv+yMyVoHrE1DbVgZ1ImBr/KA9FqgVg+ytep5y96NYb P52A== X-Gm-Message-State: AOAM530/GfJKlSxJuv8cpApyKZalnQr7Rjap9D4Urglpwmc43feTBBLV Sd3Tmhct38M9yU52GpqY8+QQFM9IRn5eJUAkI/D9uPnn X-Received: by 2002:a05:6602:2fcf:: with SMTP id v15mr468637iow.78.1597373148326; Thu, 13 Aug 2020 19:45:48 -0700 (PDT) MIME-Version: 1.0 References: <1597368611-7631-1-git-send-email-zhaoyang.huang@unisoc.com> <20200814014355.GS17456@casper.infradead.org> <20200814020700.GT17456@casper.infradead.org> <20200813193307.d5597367b7964d95f63e4580@linux-foundation.org> In-Reply-To: <20200813193307.d5597367b7964d95f63e4580@linux-foundation.org> From: Zhaoyang Huang Date: Fri, 14 Aug 2020 10:45:37 +0800 Message-ID: Subject: Re: [PATCH] mm : update ra->ra_pages if it's NOT equal to bdi->ra_pages To: Andrew Morton Cc: Matthew Wilcox , Roman Gushchin , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 14, 2020 at 10:33 AM Andrew Morton wrote: > > On Fri, 14 Aug 2020 10:20:11 +0800 Zhaoyang Huang wrote: > > > On Fri, Aug 14, 2020 at 10:07 AM Matthew Wilcox wrote: > > > > > > On Fri, Aug 14, 2020 at 02:43:55AM +0100, Matthew Wilcox wrote: > > > > On Fri, Aug 14, 2020 at 09:30:11AM +0800, Zhaoyang Huang wrote: > > > > > file->f_ra->ra_pages will remain the initialized value since it opend, which may > > > > > be NOT equal to bdi->ra_pages as the latter one is updated somehow(etc, > > > > > echo xxx > /sys/block/dm/queue/read_ahead_kb).So sync ra->ra_pages to the > > > > > updated value when sync read. > > > > > > > > It still ignores the work done by shrink_readahead_size_eio() > > > > and fadvise(POSIX_FADV_SEQUENTIAL). > > > > > > ... by the way, if you're trying to update one particular file's readahead > > > state, you can just call fadvise(POSIX_FADV_NORMAL) on it. > > > > > > If you want to update every open file's ra_pages by writing to sysfs, > > > then just no. We don't do that. > > No, What I want to fix is the file within one process's context keeps > > using the initialized value when it is opened and not sync with new > > value when bdi->ra_pages changes. > > So you're saying that > > echo xxx > /sys/block/dm/queue/read_ahead_kb > > does not affect presently-open files, and you believe that it should do > so? > > I guess that could be a reasonable thing to want - it's reasonable for > a user to expect that writing to a global tunable will take immediate > global effect. I guess. > > But as Matthew says, it would help if you were to explain why this is > needed. In full detail. What operational problems is the present > implementation causing? The real scenario is some system(like android) will turbo read during startup via expanding the readahead window and then set it back to normal(128kb as usual). However, some files in the system process context will keep to be opened since it is opened up and has no chance to sync with the updated value as it is almost impossible to change the files attached to the inode(processes are unaware of these things). we have to fix it from a kernel perspective.