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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A2A3C433F5 for ; Thu, 7 Oct 2021 13:47:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9349961090 for ; Thu, 7 Oct 2021 13:47:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9349961090 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 145B86B0071; Thu, 7 Oct 2021 09:47:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F5EF6B0072; Thu, 7 Oct 2021 09:47:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00B63900002; Thu, 7 Oct 2021 09:47:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id E47186B0071 for ; Thu, 7 Oct 2021 09:47:06 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9FD84183CF8BD for ; Thu, 7 Oct 2021 13:47:06 +0000 (UTC) X-FDA: 78669767652.27.BF18A3E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id 12E2E1F5D for ; Thu, 7 Oct 2021 13:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=607rztqRurXcY14w9Lgc+y2pxf9wdHgqF9UDj5T8biM=; b=i0oyafqgh03DwZSBCYa3ytf/J4 jaRFZw2g6BerSc7ArUtWmeu0hS/gl+nZU7rA6uO2sRIKMgHwujuFM5nlu1Pl0moOBY6sSzwPOKG0h EP0a7E1bBXMtvMY5HLdId/INO5ch7NqW2efZh/y7dZMF1Jl1tBVrI8TLhT92zN4HZ5+sJFlabMiXL /maSZx+Tgk5Rfz/jnWizFMlQM0LupV5M4dJcK1VsSMBFu2I+9i/M9XTGjTH8sYeQiPyswt6O6echA 7U3d0Z/2FQDRK7VQg7d80D8WCxlF7sZgIv2QiTd0Avg8uv/Z9yCcHl3mdgno432WBzYfv3ZafrRfd wuUMYEZA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYTiY-001tvX-WC; Thu, 07 Oct 2021 13:46:02 +0000 Date: Thu, 7 Oct 2021 14:45:50 +0100 From: Matthew Wilcox To: Hsin-Yi Wang Cc: Andrew Morton , William Kucharski , Christoph Hellwig , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Phillip Lougher Subject: Re: Readahead regressed with c1f6925e1091("mm: put readahead pages in cache earlier") on multicore arm64 platforms Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 12E2E1F5D X-Stat-Signature: o9i7we51ay4kjoqxu4a86z6dm7y7ms7h Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=i0oyafqg; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1633614425-59860 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, Oct 07, 2021 at 03:08:38PM +0800, Hsin-Yi Wang wrote: > This calls into squashfs_readpage(). Aha! I hadn't looked at squashfs before, and now that I do, I can see why this commit causes problems for squashfs. (It would be helpful if your report included more detail about which paths inside squashfs were taken, but I think I can guess): squashfs_readpage() squashfs_readpage_block() squashfs_copy_cache() grab_cache_page_nowait() Before this patch, readahead of 1MB would allocate 256x4kB pages, then add each one to the page cache and call ->readpage on it: for (page_idx = 0; page_idx < readahead_count(rac); page_idx++) { struct page *page = lru_to_page(pages); list_del(&page->lru); if (!add_to_page_cache_lru(page, rac->mapping, page->index, gfp)) aops->readpage(rac->file, page); When Squashfs sees it has more than 4kB of data, it calls grab_cache_page_nowait(), which allocates more memory (ignoring the other 255 pages which have been allocated, because they're not in the page cache yet). Then this loop frees the pages that readahead allocated. After this patch, the pages are already in the page cache when ->readpage is called the first time. So the call to grab_cache_page_nowait() fails and squashfs redoes the decompression for each page. Neither of these approaches are efficient. Squashfs need to implement ->readahead. Working on it now ...