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 11436C433EF for ; Fri, 8 Oct 2021 04:11:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7FE7060FC4 for ; Fri, 8 Oct 2021 04:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7FE7060FC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 89F61900002; Fri, 8 Oct 2021 00:11:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84E366B0072; Fri, 8 Oct 2021 00:11:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73CA9900002; Fri, 8 Oct 2021 00:11:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 68ACA6B0071 for ; Fri, 8 Oct 2021 00:11:32 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E951718265D3F for ; Fri, 8 Oct 2021 04:11:31 +0000 (UTC) X-FDA: 78671945982.40.5C739B2 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) by imf11.hostedemail.com (Postfix) with ESMTP id A0719F002848 for ; Fri, 8 Oct 2021 04:11:31 +0000 (UTC) Received: by mail-il1-f177.google.com with SMTP id k13so8594809ilo.7 for ; Thu, 07 Oct 2021 21:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uXTUDJeSSZP7R5MQLkITGVvuZRsjMUzYbj73AZNZ2F4=; b=CjhqAwnk4JmMS35N1cyMZ2npni4FxyMIQR1c5FNlVa7sAhhtm2y33M+auLZdhuKria 8MvfCwka1IK1gaWgYt9vZNwiIpzBQJOBMQkWaLIYWoy5hwrOzaAF3MBYWCH6sBTR5++F xwVGgytdVarrjGGeTyKvTNkZRi8AgsSGAo/g8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uXTUDJeSSZP7R5MQLkITGVvuZRsjMUzYbj73AZNZ2F4=; b=0GfjR7uFCpjglpc+cCfkL6EqE5wG9q39Riz3k2p0VMbKBAOZ+58EPCMP8OLyKypIjj 3WsEmtEHR0x96yoZYo4e5DlX7EvBZikE+e5ru1Zfo/2M6oatXIT8043LsolxtEarf38L Q6xrwr+AG0aA3nraqX0PNiVrskjsSlwhw3yz9iXGiWNt0i9PbdIoc1K/I/m7x8E7c5oJ KQtK4r9nlV4CU8CdxRD+2/qChjkAqWcMeHRVetzalt5EGWNozNG8EZOj4+t+YXboawGR JXFsMS1STr+3XzNpSvMK/XGkSlmfMFw1i6LFN5NrwxU+ICe8+Wup/H7xevL7dUvt/v5G yK/Q== X-Gm-Message-State: AOAM533ZB5noYq/xeWv2us8zvogAjaLs7Lh2soMt7nefOo1DkZSj+T2Z qaJhprBzT7STYB6h2D+cZ1XoBtT9SeaRrhBcsqTa8w== X-Google-Smtp-Source: ABdhPJxi4hbGcN33/45t2W0AswoxgW37VS0j8R875zThFFQSNCrBzDYilGvSf2g1VzGbOSpwj/T3gVNDQp9npZCqIs8= X-Received: by 2002:a05:6e02:1aa4:: with SMTP id l4mr5983277ilv.231.1633666290966; Thu, 07 Oct 2021 21:11:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hsin-Yi Wang Date: Fri, 8 Oct 2021 12:11:05 +0800 Message-ID: Subject: Re: Readahead regressed with c1f6925e1091("mm: put readahead pages in cache earlier") on multicore arm64 platforms To: Matthew Wilcox Cc: Andrew Morton , William Kucharski , Christoph Hellwig , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Phillip Lougher Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A0719F002848 X-Stat-Signature: yffxc635t73j48bxupg7nrpkcamo31ro Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=CjhqAwnk; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf11.hostedemail.com: domain of hsinyi@chromium.org designates 209.85.166.177 as permitted sender) smtp.mailfrom=hsinyi@chromium.org X-HE-Tag: 1633666291-790380 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 7, 2021 at 9:46 PM Matthew Wilcox wrote: > > 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() > Right, before the patch, push_page won't be null but after the patch, grab_cache_page_nowait() fails. > 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 ... >