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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D34F9C433EF for ; Thu, 27 Jan 2022 00:32:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C8BE6B0071; Wed, 26 Jan 2022 19:32:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 277DF6B0072; Wed, 26 Jan 2022 19:32:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 140016B0073; Wed, 26 Jan 2022 19:32:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 0670D6B0071 for ; Wed, 26 Jan 2022 19:32:12 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5392C8249980 for ; Thu, 27 Jan 2022 00:32:11 +0000 (UTC) X-FDA: 79074190062.07.CB83AB1 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf12.hostedemail.com (Postfix) with ESMTP id D137940004 for ; Thu, 27 Jan 2022 00:32:10 +0000 (UTC) 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> X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D137940004 X-Stat-Signature: oi9tzbjntj8ge6n1ipydf9ipmtrsiehq Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=NAgRhQEU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=WbvBw4gQ; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf12.hostedemail.com: domain of neilb@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=neilb@suse.de X-HE-Tag: 1643243530-5147 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 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