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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07E20C433E0 for ; Sat, 9 Jan 2021 02:04:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D6A923A3C for ; Sat, 9 Jan 2021 02:04:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D6A923A3C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 698058D01C8; Fri, 8 Jan 2021 21:04:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 61F8B8D01B7; Fri, 8 Jan 2021 21:04:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 499298D01C8; Fri, 8 Jan 2021 21:04:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 2F1CA8D01B7 for ; Fri, 8 Jan 2021 21:04:42 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E52DB824556B for ; Sat, 9 Jan 2021 02:04:41 +0000 (UTC) X-FDA: 77684592762.06.alarm46_4405792274f7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id B9E2D10041F6F for ; Sat, 9 Jan 2021 02:04:41 +0000 (UTC) X-HE-Tag: alarm46_4405792274f7 X-Filterd-Recvd-Size: 7457 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sat, 9 Jan 2021 02:04:41 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id b26so27457056lff.9 for ; Fri, 08 Jan 2021 18:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8X0k10gEU5RU+YALYiXkZo4igtQpWwlajig6tj8kuiQ=; b=fZb6v61atyzfrrDYtqgFHKlNTWj+llarfBgW2li3VAHFiI9v2whnfzp2rPIc5ME6Yc Il4xP9F756ShlIumSNYfUGhyiNgKXRDeenhBPiEROH7todZP8SZEJwYoIcuCW/Bi8yq0 JCY1lGtZvB1umvqAU5nCSrnSEPKAUUN+TXGlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8X0k10gEU5RU+YALYiXkZo4igtQpWwlajig6tj8kuiQ=; b=Y7JYPeJQ3jULpRjbJWh0QyM7BuwLX5WWqKXoBm/wSMNZw46eE8d/ukEgw4tGtG8XkF quRHVpMkO7zJQoCdnF7jbHwhEHolb75/4LrmuzaZvr0Uo7YQ6osCXgAvRmUcVzJZOSnI DuR1GeUL5Ps+e9S9mBrn6pcaWhDogm/FBOIKy/XJKtmYN/c2bd/fSOqycl6Xx2KjVewh AazRZpO56HNGX3dv1Fwg3zsiA9n9Pgpi+kUnaeq5FB60BnjR162KZytK4VDAITsumHFR b4eUGO/Wgfk8RMKY8LtsnBx/UTBioFdmMvBlGKbmfwP1wjfB2ImxM7oUSWfMZRyuX3k5 Oa1Q== X-Gm-Message-State: AOAM533z2kphxRQtCE8Hz9V49mmeJl8gm9j91noWlavJGs7peMpFPXa9 q0j1rQvXvHkPOyi2eFOrjucjj60byyvKWQ== X-Google-Smtp-Source: ABdhPJzCCvttZCOCtL8AH8/McHeM+ZY6zLI3TyZmHLBHlaGkEXjvKhxSCmV5FwI2zm0Tan/zDUdf/A== X-Received: by 2002:ac2:446c:: with SMTP id y12mr2552213lfl.373.1610157879121; Fri, 08 Jan 2021 18:04:39 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id m25sm1506614lfb.144.2021.01.08.18.04.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 18:04:37 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id a12so27477555lfl.6 for ; Fri, 08 Jan 2021 18:04:37 -0800 (PST) X-Received: by 2002:ac2:41d9:: with SMTP id d25mr2429298lfi.377.1610157877097; Fri, 08 Jan 2021 18:04:37 -0800 (PST) MIME-Version: 1.0 References: <000000000000886dbd05b7ffa8db@google.com> <20210104124153.0992b1f7fd1a145e193a333f@linux-foundation.org> In-Reply-To: From: Linus Torvalds Date: Fri, 8 Jan 2021 18:04:21 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: kernel BUG at mm/page-writeback.c:LINE! To: Hugh Dickins Cc: Andrew Morton , Matthew Wilcox , syzbot , Linux Kernel Mailing List , Linux-MM , syzkaller-bugs Content-Type: multipart/mixed; boundary="0000000000004c20ba05b86e1822" 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: --0000000000004c20ba05b86e1822 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 5, 2021 at 11:53 AM Linus Torvalds wrote: > > I took your "way to go" statement as an ack, and made it all be commit > c2407cf7d22d ("mm: make wait_on_page_writeback() wait for multiple > pending writebacks"). Oh, and Michael Larabel (of phoronix) reports that that one-liner does something bad to a few PostgreSQL tests, on the order of 5-10% regression on some machines (but apparently not others). I suspect that's a sign of instability in the benchmark numbers, but it probably also means that we have some silly condition where multiple threads want to clean the same page. I sent him a patch to try if it ends up being better to just not wake things up early at all (instead of the "if" -> "while") conversion. That trivial patch appended here in case anybody has comments. Just the fact that that one-liner made a performance impact makes me go "hmm", though. Michael didn't see the BUG_ON(), so it's presumably some _other_ user of wait_on_page_writeback() than the write_cache_pages() one that causes issues. Anybody got any suspicions? Honestly, when working on the page wait queues, I was working under the assumption that it's really just the page lock that truly matters. I'm thinking things like __filemap_fdatawait_range(), which doesn't hold the page lock at all, so it's all kinds of non-serialized, and could now be waiting for any number of IO's ro complete.. Oh well. This email doesn't really have a point, it's more of a heads-up that that "wait to see one or multiple writebacks" thing seems to matter more than I would have expected for some loads.. Linus --0000000000004c20ba05b86e1822 Content-Type: application/octet-stream; name=patch Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kjp1dr5k0 IG1tL2ZpbGVtYXAuYyAgICAgICAgfCA2ICsrKystLQogbW0vcGFnZS13cml0ZWJhY2suYyB8IDIg Ky0KIDIgZmlsZXMgY2hhbmdlZCwgNSBpbnNlcnRpb25zKCspLCAzIGRlbGV0aW9ucygtKQoKZGlm ZiAtLWdpdCBhL21tL2ZpbGVtYXAuYyBiL21tL2ZpbGVtYXAuYwppbmRleCA1YzlkNTY0MzE3YTUu LjAzMWQxOWQwZjRiMiAxMDA2NDQKLS0tIGEvbW0vZmlsZW1hcC5jCisrKyBiL21tL2ZpbGVtYXAu YwpAQCAtMTA1MiwxNCArMTA1MiwxNiBAQCBzdGF0aWMgaW50IHdha2VfcGFnZV9mdW5jdGlvbih3 YWl0X3F1ZXVlX2VudHJ5X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