Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5818752pxb; Wed, 26 Jan 2022 23:28:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJye/rwS4ZwqI7XyGJR1Fd7pFjBXOs3q2DRWaA28SI3MTmHKab6mWI7kUHFO5g/yHj9ebXvH X-Received: by 2002:a17:902:710c:: with SMTP id a12mr2179490pll.13.1643268504120; Wed, 26 Jan 2022 23:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643268504; cv=none; d=google.com; s=arc-20160816; b=AsL5UBxAL6K8mXsYYk0n6F4/CEXsDFxY78x8n2j33RAjmVKuHTBUFNtghL375LnwRr 8ECY9TrkBuYQnc8OGwk6Cpb8lyBKQX+vKqPC8JoJzd8/O0UxtJiLromenkYpUaPcfkwm cqRk2/nCIrt1KqeE2G619uHsVNaSvRyICS+1laKPApJBMYVhXwx/Feqn3HcpmbZuNC4q xy9kU4xrGDuuaYZm18qRoS4vztXkosoOPPJJDuG+L42Pe8WPcUh+xmlC77+LzEpWQbB1 7cH7KzVORPST5EGI5tx5+qayyOPGoQz8pAHDXLXUurk6HKa0EGzBGff8/VnAcus1/Yml 7czg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=iullOb3Z+e2T0lhh1xDMAxJ/4/RT+jyxcMAIPZ1IZgs=; b=j6sM9a+rL2BGWG5Aa8u1sV9/3yNWbIjh5/nM6gan5ld2QO+ogTwY1VeB95oPXla8Iv oKt+uGX6ottdaM7xB4UaCzJL3lDHR5RAA/YO8gho+uB1PxmcnOQ+VYNR5F6IVYXIjA4+ AwhMA67UMfmYYhAYiOdDDSQQsytik1Qga+NsKbMrbUpjp0jXrqen8GWyfHTjADo6zqkK hRvdQ7n8/nvvKH1o63dubS2I9d+IY6OKaLWuWsi2fhzj/mJ3pa45fRwSCDNFRa58te4b Yo7un69/ProbCAZtVl5Ri1DZ+mBJSb7F7ZKRKxif6c/Ad3jvyp8qCfph2p+PN3tJQu/1 IMcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=NAgRhQEU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=WbvBw4gQ; 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=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si1717822pgi.789.2022.01.26.23.28.12; Wed, 26 Jan 2022 23:28:24 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=NAgRhQEU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=WbvBw4gQ; 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=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233907AbiA0AcL (ORCPT + 99 others); Wed, 26 Jan 2022 19:32:11 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:47348 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiA0AcK (ORCPT ); Wed, 26 Jan 2022 19:32:10 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5B74621114; Thu, 27 Jan 2022 00:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643243529; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iullOb3Z+e2T0lhh1xDMAxJ/4/RT+jyxcMAIPZ1IZgs=; b=NAgRhQEURd360hIYSbsXGGRw5yP1FfqvbZkytP6OOwl/Lm4Z/cpiscUnKxd/4sRC1mzdDL 2/8+YKYaXacbg+jwvuMZdWs1iDNx/0FKAcc3ayUgvyZF0H1wzSztgUd7C15eW9EbxPzBe7 yvee1bV+CHp2odSEGAgU8nJuve9ynNs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643243529; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iullOb3Z+e2T0lhh1xDMAxJ/4/RT+jyxcMAIPZ1IZgs=; b=WbvBw4gQHJnfJGVuvuZtyXS9PxDOGDGLq5ACD7bBstqSyP57g3MNwJtAAzOA7DqCrafozf xtkWF4xr7luYMJAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F112813E72; Thu, 27 Jan 2022 00:32:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JFZ0KgXo8WHqfQAAMHmgww (envelope-from ); Thu, 27 Jan 2022 00:32:05 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Hugh Dickins" Cc: "Christoph Hellwig" , "Trond Myklebust" , "Anna Schumaker" , "Chuck Lever" , "Andrew Morton" , "Mel Gorman" , "David Howells" , linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/23] MM: extend block-plugging to cover all swap reads with read-ahead In-reply-to: References: <164299573337.26253.7538614611220034049.stgit@noble.brown>, <164299611274.26253.13900771841681128440.stgit@noble.brown>, , <164323362698.5493.8309546969459514762@noble.neil.brown.name>, Date: Thu, 27 Jan 2022 11:32:02 +1100 Message-id: <164324352246.5493.62203138362718756@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Jan 2022, Hugh Dickins wrote: > On Thu, 27 Jan 2022, NeilBrown wrote: > > On Mon, 24 Jan 2022, Christoph Hellwig wrote: > > > On Mon, Jan 24, 2022 at 02:48:32PM +1100, NeilBrown wrote: > > > > Code that does swap read-ahead uses blk_start_plug() and > > > > blk_finish_plug() to allow lower levels to combine multiple read-ahead > > > > pages into a single request, but calls blk_finish_plug() *before* > > > > submitting the original (non-ahead) read request. > > > > This missed an opportunity to combine read requests. > > No, you're misunderstanding there. All the necessary reads are issued > within the loop, between the plug and unplug: it does not skip over > the target page in the loop, but issues its read along with the rest. > > But it has not kept any of those pages locked, nor even kept any > refcounts raised: so at the end has to look up the target page again > with the final read_swap_cache_async() (which also copes with the > highly unlikely case that the page got swapped out again meanwhile). > .... > > I don't suppose your patch does any actual harm (beyond propagating a > misunderstanding), but it's certainly not a fix, and I think should > simply be dropped from the series. Thanks - I had missed that. The code is correct, but looks wrong (to me). I've dropped the patch, but added a comment when I add "swap_read_unplug()" to explain while plugging isn't needed for that final read_swap_cache_async(). > > (But please don't expect any comment from me on the rest: > SWP_FS_OPS has always been beyond my understanding.) :-) Thanks, NeilBrown