From patchwork Tue Jun 25 10:18:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 13710834 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 A672EC30653 for ; Tue, 25 Jun 2024 10:19:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29F5D6B02ED; Tue, 25 Jun 2024 06:19:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 123F86B02FC; Tue, 25 Jun 2024 06:19:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF0DB6B02F2; Tue, 25 Jun 2024 06:19:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 819CB6B02EE for ; Tue, 25 Jun 2024 06:19:14 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 211F2C1828 for ; Tue, 25 Jun 2024 10:19:14 +0000 (UTC) X-FDA: 82269013428.07.F6D09B5 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf19.hostedemail.com (Postfix) with ESMTP id D797B1A0012 for ; Tue, 25 Jun 2024 10:19:11 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=CPRQuFTH; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=LSKvBC6Y; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=CPRQuFTH; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=LSKvBC6Y; spf=pass (imf19.hostedemail.com: domain of jack@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719310744; a=rsa-sha256; cv=none; b=sZFd41AtC/hf1eFZeUUzuFUs0ZvNg8pG2Ocwzp07GvcO4YL2UntiBh7Hc7aJX4j5TOCR8e 2z2uhIMr+XMCZAL9wr33HtryPpb7I2l8X26iWonSDx2Ycvviy5gFHPxOg+ltOzHfIntPvP 6PKA8ssnl9OH3fHvKhAhdNcaH6ECCQs= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=CPRQuFTH; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=LSKvBC6Y; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=CPRQuFTH; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=LSKvBC6Y; spf=pass (imf19.hostedemail.com: domain of jack@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719310744; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1mV9dyLmEXPNThSQksaqyuEvMuZusgKZh1jasd7YbD0=; b=XhMyVPw8IAv8E6bon+sVbkv+lQRCMHGMd9DAfcapnBoKjhADnIsPPlF3wnIk94baF6L7mg h34DiXO4gOtSWi5Mj3aGzJpu29tosU5T0sUMTOF65xLbZsbzQkEII8066xFyFNXvA7/kz9 P/kFX9y4zgI74SbdwCqY23aFjAi2EHc= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 44D7B21A76; Tue, 25 Jun 2024 10:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1719310750; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1mV9dyLmEXPNThSQksaqyuEvMuZusgKZh1jasd7YbD0=; b=CPRQuFTHYwVxIVw+g2eMSlxsPjbggxxUXCQfRNDhD1NlW8q6JLK8+CshOYwk6anmoR3fUl fI1wjbJGYN2Y8P24bTasEf3jjhhar0FnMXRlnHgM5D8It4y/VOV3MTGZYxKM6yR3vEEjtQ HWweKL5aMgQia8Ifc1QTcjwFPIGBNHk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1719310750; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1mV9dyLmEXPNThSQksaqyuEvMuZusgKZh1jasd7YbD0=; b=LSKvBC6YgkeWCQAEFbdQnz+TjvBIusyCMWFQdOKdssCqrHIdrT1waldL2D1hTjtrGOQ9fI NisUhjrFQLpG+0Dg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1719310750; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1mV9dyLmEXPNThSQksaqyuEvMuZusgKZh1jasd7YbD0=; b=CPRQuFTHYwVxIVw+g2eMSlxsPjbggxxUXCQfRNDhD1NlW8q6JLK8+CshOYwk6anmoR3fUl fI1wjbJGYN2Y8P24bTasEf3jjhhar0FnMXRlnHgM5D8It4y/VOV3MTGZYxKM6yR3vEEjtQ HWweKL5aMgQia8Ifc1QTcjwFPIGBNHk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1719310750; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1mV9dyLmEXPNThSQksaqyuEvMuZusgKZh1jasd7YbD0=; b=LSKvBC6YgkeWCQAEFbdQnz+TjvBIusyCMWFQdOKdssCqrHIdrT1waldL2D1hTjtrGOQ9fI NisUhjrFQLpG+0Dg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3667A13AD9; Tue, 25 Jun 2024 10:19:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cwcuDZ6ZemZyWQAAD6G6ig (envelope-from ); Tue, 25 Jun 2024 10:19:10 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id CF449A091A; Tue, 25 Jun 2024 12:19:09 +0200 (CEST) From: Jan Kara To: Cc: Andrew Morton , Matthew Wilcox , , Jan Kara Subject: [PATCH 02/10] filemap: Fix page_cache_next_miss() when no hole found Date: Tue, 25 Jun 2024 12:18:52 +0200 Message-Id: <20240625101909.12234-2-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240625100859.15507-1-jack@suse.cz> References: <20240625100859.15507-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=922; i=jack@suse.cz; h=from:subject; bh=lEGZ9ceRJWeyyjOzqii5re2SDGP3X5uqvnDqu1Uy374=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBmepmNR+m8V1id025gA4id7xWJlDI2ShIvOoiMTjnx wFCStsOJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZnqZjQAKCRCcnaoHP2RA2ayRB/ 9Vncl9kDets3toPAMTLaVJH0Fp94LwwQ3A3q5pHytHp6I9LoJZ3gp6ZKcPsBivY1Mj5hyKeePMiHML esiIA89Qw5DzBd7UOQ3Nl02fWfbW7Opb3mVqgEM6HSs0DnwJLupoO2QCsv7vK9vTnQijG4iTH4B+nw UwqI3m37d5mrTvjEsJ8GBGqbZspt/gpTntHImQlJkfG1si+upQb4hwjcKDpNfWZfANaVjSzXe2+bom vcZdBrUot3hp5CHlD+zo9p8XDMUJ1E6IVeqIS4FQ9I/NjRwZSgv80DA/ARsF9d+/ZlOkknM4oc2Kza PyzKdZGZQltTyARM56NBoyf7VcK13N X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C X-Stat-Signature: s8zad4bfo5udo3fymk8fi37a3m1higns X-Rspamd-Queue-Id: D797B1A0012 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719310751-455772 X-HE-Meta: U2FsdGVkX1/bwuh0lNFJq0VyjZzil1Q1R9IjAYZdT5RhTSHu0JdiL49vAimhb0gOmbvQVucbIzdFgBCf/sS6L+Jdyp6m4CFQdV7e7ljuJYME8pmVG+Rf0EDrsmeNZCHf1h8lVcWi/Kb0h/Uvt1Zb3riAZR0CjpfqxMki+q/nzy+zApzZNz4VE9jgFSjdBY7Jxq6uF+HUl0l7jfj5gSyLk2/JDNnx6z8Z4QsmHaeww7gQMlssV4caE1+sktToSN6wyFnwmQlavPiLRVaDH32PgPII+Ci90jKMmkybNwhQYDQ32ITiBqqNxgK26eu1ZAWg9s52n25pyzdpsPqlRKT5I+tO1biomusLLKVaRFBI7jHQ/zyQ6bljTNiXEP643w6Poa2cJ0/Vr2T5UJnRU+0l+zoj78+aPvRS9PlMiuSqITNEDDSim50Iitre8dJZBmTveEZdfjnQRxX2GD75i3aXKPK6Fc9aLLdEfvQBuTglvjtmq4DHuU9pZRHrmIbir1GVmVHUW/7ZXo3RE62pWlHdc+oWD7Te/Qj4ISyngKrYe7GYogxClnAiAdq/3GwMYmXVJwaphmmKkepNsl7yDYahbZq3ABaxiwWzDpPulHcxcgPqLGY6lVh0vv+2ESn8OtCq3+U07LHbpH2zstsXGHLw8+T/Lphq2O532GPoMtXonvSUjKk9jkITf0I0jS4cu0JjnOrhXaDD7p8EWBlZsnrrICu/rxpPjISq1DxU0LyjveOHf1PLnydbX3n2zzEeoLIJvmZt+QInpSO+8Ya/7Rk7IX2S7dJWvL9ND043duB8aaASgZmN09OWTebgjTASNeIhz03kFUkkAbw+B/VzM6UYlTOW1gcfeqlksYPnWk1mF+2/8Xi4kblen5KcfqspBEfIxOMbVfG2NELUoXe9vCbWNTMle8mmzzJa9xv5kgGU9RPSSNSeZ+x81MDf3Um9CTmVpQX1x7CgV7w66hG61Tx WDIANviU D+aMeTWkbQNMy4xu4CjtHUkq/9VTLoDs0PIyZndhccE+OlPPZMV2wi5l1f5esmoKrSkxwo1tUJeUTfjRulH5oJR+scbinx6S+/X/9dE/FJBS6/9ATojfzW17V7F7VzOaae1fKPhyCDDCyTZbVx76P8XX0PraoRtTmWBKNNO7MEA8Vxl7oHtQTDBDz5e8o5wy1EiooZDoPPATuECPfibkFXTopSaIHkEq1oQltCyAPJe1/DCbvnK0lB1ia6e2y+O8/JF+h 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: List-Subscribe: List-Unsubscribe: page_cache_next_miss() should return value outside of the specified range when no hole is found. However currently it will return the last index *in* the specified range confusing ondemand_readahead() to think there's a hole in the searched range and upsetting readahead logic. Signed-off-by: Jan Kara --- mm/filemap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 876cc64aadd7..015efc261468 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1752,12 +1752,12 @@ pgoff_t page_cache_next_miss(struct address_space *mapping, while (max_scan--) { void *entry = xas_next(&xas); if (!entry || xa_is_value(entry)) - break; + return xas.xa_index; if (xas.xa_index == 0) - break; + return 0; } - return xas.xa_index; + return index + max_scan; } EXPORT_SYMBOL(page_cache_next_miss);