Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp749665pxb; Fri, 8 Jan 2021 18:08:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8DBTyPs7JtqE4qumhADOolb8q+BKSiKbatrlHiyqON40bHc9sfWC13ZTKvBw4VzgQRzOk X-Received: by 2002:a05:6402:45:: with SMTP id f5mr7066462edu.273.1610158093314; Fri, 08 Jan 2021 18:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610158093; cv=none; d=google.com; s=arc-20160816; b=aMpN7WrIOqFwFG50RCRkHgJsefpyAWpO+2S63NS168c7xDrT7w/jclfClN2ky03Bfc fLWAn0j/nDEM4Pp66pIRsTgDCJvuxwQn/1afsIEw/+faMAvYbhnL009DiRVVuYkzOT15 O06pbnStnqMW4foqP47LiIn4zvrT9mgXXwUTZVF0liZ5hp/LdLh6OYzWbvHcH7zze6p7 7LlNo4F3XnG/hhPpLcFs8IaES14WJFh1P4rIVGk7DE8JRMB7WcEZCUR+O9EQzbXPvs4u YsJ0Euzq4hnqUKB9uhHLLINcrF2yqL+ok1Cm/2kjDthhP1kuKLdun7OhOaz6NPCfiAr1 9DsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8X0k10gEU5RU+YALYiXkZo4igtQpWwlajig6tj8kuiQ=; b=DDhbPYwef+SboMCA5S/4FRb3S6g2bLp4ZpAkS9aiOIVf2K+pBscCksI0Ftz23tUHpW moRsxDFipsV2zntI89DBJqRzP09neoRzNc1LbeeByOtjhSQfu+PCJLeAab6LwYXRReWk 7qn208QBMuXe/ja2iTTw8zpaqsxmdqk3nnehYF+rU8IYqZuiNwOdxZUWCIhyiJ6H89st bPR23EjI4Gscq1ZSyZvgV73IRQ8QZwdOh+gVwISOlypnVMgJpokyvBzOQY1SXoMWXIZB XKaLmGaCXSDSkw7SbBXRD5IxIHM1rd/4FZhVmXwM0vhLtYLVn82CINeZSxoXg/vlaD+R KROg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=fZb6v61a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si4088219eja.441.2021.01.08.18.07.49; Fri, 08 Jan 2021 18:08:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=fZb6v61a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726013AbhAICFW (ORCPT + 99 others); Fri, 8 Jan 2021 21:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbhAICFV (ORCPT ); Fri, 8 Jan 2021 21:05:21 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0923DC061573 for ; Fri, 8 Jan 2021 18:04:41 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id h205so27481642lfd.5 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=QqyETM04rubwl6Su3hOoSlUFdhurTPYP0LUT9zXodazQFzTsqHozYGqb2A7HPCyXfG 7pVSdRkBdMdSKJDU3Qcx8csF33Fbx6/fzNizbjsdOHPSnF4xkxMZKzh9ZVOSr0mr4sJs TSWfV4PLTq3UO72X2VWEscgIYR0F3ZNtOaHYUK9anlhnJjlv3w/ODRO1bC87CRmHUy8a dpBmiONRzSd7gkBLtXDteX+AdrThG8I2dBqxeMeRFyrfXxSX90C1CYAY/oJN1SL5dvxa d4qdSbPn/tBy/JjE+LijbrbApOzUjc0GP1n83AmFbv9WoYdkqI/M9ZCeTgo/IpaT0JMt 1Wcg== X-Gm-Message-State: AOAM5304ye6su/pJW5aTd1DgxlJoLbgCYOL6pO1Gi/vTBLs9jc6iI8lu LaTTdl96pj8bXYe7I0HNvDg4TnPp1ZTS9w== X-Received: by 2002:a2e:3314:: with SMTP id d20mr2803667ljc.21.1610157879210; Fri, 08 Jan 2021 18:04:39 -0800 (PST) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id l28sm1439927lfk.25.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-f49.google.com with SMTP id o10so16548248lfl.13 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --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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