Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8988568ybi; Tue, 23 Jul 2019 19:33:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQiehRYfIzXcgbiDx/zgj5TQOo+gs5sEwxQbqA7UN1A9GiylCU3whb2OQUCzEYKM0+plc8 X-Received: by 2002:a17:902:6a2:: with SMTP id 31mr79247077plh.296.1563935583946; Tue, 23 Jul 2019 19:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935583; cv=none; d=google.com; s=arc-20160816; b=jj7GuP58vrg4tllzOfJKKqj5Snwa22vxM9uEpqrJXBHGb7AU32Pm/DOIDP7WcqIZoM j6tt4z4cVLQ4FMZBpsdUwn+/vlrcu3Sb5GCYX7Nd7qhLZyXf4ThJQ/zdv8JlpB1yfD0O wQiXZcsZ9g8kuzxYQzmYrmJzrE6O56cFTWViQZwJvUpeT3jCZ0EQdV/acPi5qbyTbJS+ My9WtLmq7SxAlI7tVNwM9gUdS+hsQjepwxIB288G7lD7HKoto8dnyMu8SZeo91syp3XG NNei8Gs5+AHDpRPqQwn+eYcPpl76Ii5QV19mFYDljZzDcBVVk7o3mvA2gaOsAFieX7vR utSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wWUWqMB+sxzUrOj2hwcNcJgBnFaIDbzdce5wlkTDShI=; b=CUuTVvqlP52k6pLSGBRb//L5oq8qVw7cZzug3c+j3iVuRW3CZq8q0Ht/bzR6eyDYB0 TNdOwEMnGtsbWMhf6q7D0C5lx69B4FdBkpLedL+bboykYVzZ0rMa2EXIoJaoy2sDmsNL VSvBG081ZSk/MywDobkTQjIeHqzAE95nsqlheWx6PR326qq6JdL3r8tRZP5Ggqk7Jk6X 3XpJbsbaYDTCMfTVLPTrP6PdonKxKkiocRoqL4VNyHbrij08gEzMJ9UzWJSaK3fdS1tC QHAbbm+8X7OqNrvAKSem/Djd5hVGSezWNziuMdVKgp4JrL4vZDM4UklNGCB/tvPTrTjy GrVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d22si11132662pls.112.2019.07.23.19.32.50; Tue, 23 Jul 2019 19:33:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389395AbfGWWLt (ORCPT + 99 others); Tue, 23 Jul 2019 18:11:49 -0400 Received: from mail105.syd.optusnet.com.au ([211.29.132.249]:49837 "EHLO mail105.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731838AbfGWWLt (ORCPT ); Tue, 23 Jul 2019 18:11:49 -0400 Received: from dread.disaster.area (pa49-195-139-63.pa.nsw.optusnet.com.au [49.195.139.63]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id E2B522AA6CE; Wed, 24 Jul 2019 08:11:43 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92) (envelope-from ) id 1hq2zU-0003lk-Ea; Wed, 24 Jul 2019 08:10:36 +1000 Date: Wed, 24 Jul 2019 08:10:36 +1000 From: Dave Chinner To: Jens Axboe Cc: Johannes Weiner , Andrew Morton , linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] psi: annotate refault stalls from IO submission Message-ID: <20190723221036.GY7777@dread.disaster.area> References: <20190722201337.19180-1-hannes@cmpxchg.org> <20190723000226.GV7777@dread.disaster.area> <20190723190438.GA22541@cmpxchg.org> <2d80cfdb-f5e0-54f1-29a3-a05dee5b94eb@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d80cfdb-f5e0-54f1-29a3-a05dee5b94eb@kernel.dk> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=fNT+DnnR6FjB+3sUuX8HHA==:117 a=fNT+DnnR6FjB+3sUuX8HHA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=7-415B0cAAAA:8 a=RvhrQjGMwq6Bl1CCUxgA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jul 23, 2019 at 01:34:50PM -0600, Jens Axboe wrote: > On 7/23/19 1:04 PM, Johannes Weiner wrote: > > CCing Jens for bio layer stuff > > > > On Tue, Jul 23, 2019 at 10:02:26AM +1000, Dave Chinner wrote: > >> Even better: If this memstall and "refault" check is needed to > >> account for bio submission blocking, then page cache iteration is > >> the wrong place to be doing this check. It should be done entirely > >> in the bio code when adding pages to the bio because we'll only ever > >> be doing page cache read IO on page cache misses. i.e. this isn't > >> dependent on adding a new page to the LRU or not - if we add a new > >> page then we are going to be doing IO and so this does not require > >> magic pixie dust at the page cache iteration level > > > > That could work. I had it at the page cache level because that's > > logically where the refault occurs. But PG_workingset encodes > > everything we need from the page cache layer and is available where > > the actual stall occurs, so we should be able to push it down. > > > >> e.g. bio_add_page_memstall() can do the working set check and then > >> set a flag on the bio to say it contains a memstall page. Then on > >> submission of the bio the memstall condition can be cleared. > > > > A separate bio_add_page_memstall() would have all the problems you > > pointed out with the original patch: it's magic, people will get it > > wrong, and it'll be hard to verify and notice regressions. > > > > How about just doing it in __bio_add_page()? PG_workingset is not > > overloaded - when we see it set, we can generally and unconditionally > > flag the bio as containing userspace workingset pages. > > > > At submission time, in conjunction with the IO direction, we can > > clearly tell whether we are reloading userspace workingset data, > > i.e. stalling on memory. > > > > This? > > Not vehemently opposed to it, even if it sucks having to test page flags > in the hot path. That's kinda why I suggested the bio_add_page_memstall() variant for the page cache read IO paths where this check would be required. Not fussed either way, this is much cleaner and easier to maintain IMO.... -Dave. -- Dave Chinner david@fromorbit.com