Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1042150pxk; Sat, 12 Sep 2020 08:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW7ehw6nTAQnSkGYctjc9eQHyBK/BxflsrpSjfPo3G20Ms5wh0nBWcs0tOk8qNywLO12fX X-Received: by 2002:aa7:cd06:: with SMTP id b6mr8669501edw.196.1599926235457; Sat, 12 Sep 2020 08:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599926235; cv=none; d=google.com; s=arc-20160816; b=LNZvJwtYLbDceJrLMeJJ69pytIcGV3oYkBVdGfvo7ReJ1nqT66p/2nyjqD/JBbvxtu u2uVfQNXLpLVVBe7CKHkmfDGaIlyiKlVl1ijko3PAi22A/Paa+hDCXFP/4sTR8HNOgNL HXX7FerdAax98nnUL4mh+zgmo1tbBoDJmDlZOA/hWmfn34CtoRSqufP0k3lJhDk95s9Q XRY+wnPouGC6vORng/Ta1dPXd65UrVt66iwCFXMDMdZjLFxAa1dF9o/NX12rzdvfnrMU 92CtgkfGqIq2z7uEJyYx+9N9UrmdHR2iZDpwzrnIIxTm0CUmVkuH/FyodBVpFXnnfVbZ V4KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Qc5yghyJGBgDTTfHSsXLoAfmeYI1Ary/kXXv/3UfwB8=; b=zGCHAc2tuCzM3NPs48aY+xjDox1le+EVTo8VEKcqnbrVUrcBstkfbKov0z/dSZIn9k UUyggd1sdqEhBuup+ZvUae7V1rTNitbkUFuu4CKkeUb3IrvtP1eh24pwXa0BfqS4Gtwq eEe3clKASJKlxAKEgDu0wyLiim7GrUbj/Ql2xnywubmC9+DKb6DXVNWEy1OdZWZ/7d4h SCBtzQt8ArcNWo/8w3mc4J7fug6dN4Kn6DGH9DL7v9N7n7ucXwqlBWmAAseT7S13UDW/ siMy8NcesDVvbe2DYoSm5sRJxHztW1X26BiySr6mYjusMJrO/Q5xS5ScLVY640l+TrLy a6Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=FjhCwl87; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 e4si3571204edq.182.2020.09.12.08.56.42; Sat, 12 Sep 2020 08:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=FjhCwl87; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725872AbgILPxn (ORCPT + 99 others); Sat, 12 Sep 2020 11:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbgILPxm (ORCPT ); Sat, 12 Sep 2020 11:53:42 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E8DDC061573; Sat, 12 Sep 2020 08:53:42 -0700 (PDT) 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=Qc5yghyJGBgDTTfHSsXLoAfmeYI1Ary/kXXv/3UfwB8=; b=FjhCwl87ORYo39n9Un3auXdBhI wu0axmdEZoPb8Uve5mievG0RLvAFghLys8WQSUAXqMzmzGOOmWnP4rrx+JIK3duQSf3f9mhwhMqe4 mtVp5FJV3qRcjAYl5eTRVrwShqp6/g4DQB3N03KdsMBZFoUt0HSyGVcig/YY+80LB+l0nqYgV9EJo 5uLd6kllCTqSnculuq/FIGavc/FuANsUxLDoZpPJ3yidQckO5aEwDcedMneIb8gVzZ5tipp7SOTVJ zdI4BWgWUm+rHCptwwPYbAApJBu31f1+M5o7FOd+gWG7RAjcv4LB9H3JcFYHpkrowBEbgbM+KWHu1 ah8RGPEw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH7qE-0002Ct-Je; Sat, 12 Sep 2020 15:53:30 +0000 Date: Sat, 12 Sep 2020 16:53:30 +0100 From: Matthew Wilcox To: Amir Goldstein Cc: Michael Larabel , Linus Torvalds , Ted Ts'o , Andreas Dilger , Ext4 Developers List , Jan Kara , linux-fsdevel Subject: Re: Kernel Benchmarking Message-ID: <20200912155330.GC6583@casper.infradead.org> References: <8bb582d2-2841-94eb-8862-91d1225d5ebc@MichaelLarabel.com> <0cbc959e-1b8d-8d7e-1dc6-672cf5b3899a@MichaelLarabel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sat, Sep 12, 2020 at 10:28:29AM +0300, Amir Goldstein wrote: > On Sat, Sep 12, 2020 at 1:40 AM Michael Larabel > wrote: > > > > On 9/11/20 5:07 PM, Linus Torvalds wrote: > > > On Fri, Sep 11, 2020 at 9:19 AM Linus Torvalds > > > wrote: > > >> Ok, it's probably simply that fairness is really bad for performance > > >> here in general, and that special case is just that - a special case, > > >> not the main issue. > > > Ahh. It turns out that I should have looked more at the fault path > > > after all. It was higher up in the profile, but I ignored it because I > > > found that lock-unlock-lock pattern lower down. > > > > > > The main contention point is actually filemap_fault(). Your apache > > > test accesses the 'test.html' file that is mmap'ed into memory, and > > > all the threads hammer on that one single file concurrently and that > > > seems to be the main page lock contention. > > > > > > Which is really sad - the page lock there isn't really all that > > > interesting, and the normal "read()" path doesn't even take it. But > > > faulting the page in does so because the page will have a long-term > > > existence in the page tables, and so there's a worry about racing with > > > truncate. Here's an idea (sorry, no patch, about to go out for the day) What if we cleared PageUptodate in the truncate path? And then filemap_fault() looks a lot more like generic_file_buffered_read() where we check PageUptodate, and only if it's clear do we take the page lock and call ->readpage. We'd need to recheck PageUptodate after installing the PTE and zap it ourselves, and we wouldn't be able to check page_mapped() in the truncate path any more, which would make me sad. But there's something to be said for making faults cheaper. Even the XFS model where we take the MMAPLOCK_SHARED isn't free -- it's just write-vs-write on a cacheline instead of a visible contention on the page lock.