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 X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FSL_HELO_FAKE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8946C433DF for ; Fri, 14 Aug 2020 22:17:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6308D2074D for ; Fri, 14 Aug 2020 22:17:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S6ugoHFB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6308D2074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DBE4A6B0002; Fri, 14 Aug 2020 18:17:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6FC76B0005; Fri, 14 Aug 2020 18:17:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C867D6B0006; Fri, 14 Aug 2020 18:17:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id B31A96B0002 for ; Fri, 14 Aug 2020 18:17:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7D2B35DF4 for ; Fri, 14 Aug 2020 22:17:20 +0000 (UTC) X-FDA: 77150586240.02.shelf03_1e15c2827000 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 5432B100D9AE2 for ; Fri, 14 Aug 2020 22:17:20 +0000 (UTC) X-HE-Tag: shelf03_1e15c2827000 X-Filterd-Recvd-Size: 6910 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 22:17:19 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id o5so5192098pgb.2 for ; Fri, 14 Aug 2020 15:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=a4ibtvRrxAoVM/NN3yAdW+CNBTEGC3GLvqFI/rLefWY=; b=S6ugoHFB19hswaDF7+sl0LqxfBR5gH3Qs1lHFTlv2ur9/qH60hWFtDCK0mGjTV/M7/ Ds5jeJSUtAUa0JwVvT2bJXc+mq1go2SGDmEO88HwtCVoWw2uoo1t5ks5d83pdW7wCDRe sD08nt0GktPOZTcdaKozmgQu01XfpHLFK1uuD35njHAo3aNVDd5aYe4qPvhADaNvnnzW EKnNz6Nni79odgWL8aosALhOYgqjbvDYAQHLnPRyxn9LCRpTsuszlUs46su1XVOf8gkQ BMX2BGnKOY48pVHIIqCW+XAPqtJTBTaN5W7UhPNVQiIJ4oyRhjMGtaSkIPBXfQTT7YDU jwcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=a4ibtvRrxAoVM/NN3yAdW+CNBTEGC3GLvqFI/rLefWY=; b=IB8mOj5bHV58bf0j4UY63UwnD7ZKQJA9E/KpktSlNyq5Tx/T6I2JHV4Djpf69bSBPs ybVUaNNceT5I7pLM+Y82/I7xOQPDhPVFLZnolezQOt5r86w+EekgYEPLlpq/Ty3TLhcn 4Tc2AY4wvXRe0OZ2DI/vDTqSBGR5owZDv+o76C4MUt3OxclZuiBeOnC2EYUjXwJPtZPv qDhruCUnfkjLv5iU3aOjlgdcV4sisfhg7GoXeC4gAPGzIUfj5s9SmCkSjYES7VvE4oVI O1A5UzITZ4tpNkDBRaSfs3qSg7Phz1i8hWJ8s/Er56b43orga3H6QAGHGSnpizCUVCDr cOIQ== X-Gm-Message-State: AOAM530cjZH87kOYF+gwJz/rKPNBL8oxF3rA5e9+h4E+cmyZ0LaqxXNe FgzFBZe8XsTK+WOJaFYr6ZY= X-Google-Smtp-Source: ABdhPJySVfX1y36ooWMxyTSGFMnmfvSsPaON68rV+0v2YSK1IRpYY32sA3uk9a+GhNtd/UPiXxTHRw== X-Received: by 2002:aa7:9468:: with SMTP id t8mr3163170pfq.182.1597443438653; Fri, 14 Aug 2020 15:17:18 -0700 (PDT) Received: from google.com ([2620:15c:211:1:7220:84ff:fe09:5e58]) by smtp.gmail.com with ESMTPSA id t25sm10048324pfe.51.2020.08.14.15.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 15:17:17 -0700 (PDT) Date: Fri, 14 Aug 2020 15:17:15 -0700 From: Minchan Kim To: Matthew Wilcox Cc: Zhaoyang Huang , Andrew Morton , Roman Gushchin , Zhaoyang Huang , "open list:MEMORY MANAGEMENT" , LKML , liumartin@google.com, fengguang.wu@intel.com Subject: Re: [PATCH] mm : update ra->ra_pages if it's NOT equal to bdi->ra_pages Message-ID: <20200814221715.GA2856780@google.com> 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> <20200814031929.GV17456@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200814031929.GV17456@casper.infradead.org> X-Rspamd-Queue-Id: 5432B100D9AE2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Aug 14, 2020 at 04:19:29AM +0100, Matthew Wilcox wrote: > On Fri, Aug 14, 2020 at 10:45:37AM +0800, Zhaoyang Huang wrote: > > 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. > > OK, this is a much more useful description of the problem, thank you! It's not the first time we brought up the issue. https://patchwork.kernel.org/patch/10866161/ Hopefully, we have some solution at this time. > > I can think of two possibilities here. One is that maybe our readahead > heuristics just don't work on modern phone hardware. Perhaps we need > to ramp up more aggressively by default. > > The other is that maybe it really is just a "boost at startup" kind > of situation and so we should support _that_. Some interface where > we can set a ra_boost, and then do: > > if (ra_boost) > newsize *= 2; > > in get_init_ra_size(). With kernel boot paramter, it sounds good idea to me.