Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp595994pxk; Thu, 17 Sep 2020 10:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfRuHze1SjnjGrhE1HXziBC/Xfw5otPswFvUeg4n7Ld/DyijLAVasHN4LyzLJZLqnMWsSc X-Received: by 2002:a05:6402:b1a:: with SMTP id bm26mr34454534edb.209.1600365188216; Thu, 17 Sep 2020 10:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600365188; cv=none; d=google.com; s=arc-20160816; b=GyLVota6w1lJs2L4VLyC9lfeuUdH1J5DEH8VxIbtnJpreYPXSyQFKjKo/QMODopYaj 9hZcrYxOii8vL/hUEViULJxSH0wSFvW9o1PkwWvGET314Yc6WfEYuUnE7cuYNKVqNQ0d i7lbE6IDvw5uOcETsumwoKMx1n/JMYqxqwczDw/nK/XGBoAFOwPFfJsB31FOKrrNZ+8z tL2Td9LnYVe+oPwE7iPGDxoF8rhiriPQolu66lJiuDzpN1q1YiGmzAObeaV7USdsxjA6 zSheEACMM8eC/HiWbiJLH6TYiVtse5AKNaH0iExc05PQ4+wW+4Q4zuPr58uq055Cu5tM g1xw== 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=6bZmvn6AnFCToftcYmbjrMBsBaTLLKSGSnwvFmZF6n0=; b=wlYNqAPTOBPffbrDdQ4xY6O+H2neCByFnRaXDKe3nGQw8RRRZqj2of/mZwKrYyb2fN 5N6fVaA0HY+7MfPIrohKna7nWp9iOvF8W30yuXVpFA+iOd+VGPFBUGLQjJnfsyIt6Z5V jwAyWxD3JUn4MzVy/i6L68MBGHAQSwB7xFhmWXQAWyuhYXHJnSAC10/YL2jPA5134gYh f0qzuxksVNq04w9LLoXMIYOjYIjA49aT0snUHrqjkyuAi4/J4KFC+TpgaBu+PDJaC/sl CBzcGl7kmbgRHxsLnZtGQRdS0oaRqMyhwFo1hosZQGXm4NnbB8/OuEUeaF+9SOveOyWd EhgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KiLftkuC; 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 y12si294898edv.98.2020.09.17.10.52.38; Thu, 17 Sep 2020 10:53:08 -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=pass header.i=@linux-foundation.org header.s=google header.b=KiLftkuC; 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 S1726601AbgIQRw2 (ORCPT + 99 others); Thu, 17 Sep 2020 13:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726471AbgIQRwC (ORCPT ); Thu, 17 Sep 2020 13:52:02 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DE86C061788 for ; Thu, 17 Sep 2020 10:52:02 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id k25so2825134ljk.0 for ; Thu, 17 Sep 2020 10:52:02 -0700 (PDT) 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=6bZmvn6AnFCToftcYmbjrMBsBaTLLKSGSnwvFmZF6n0=; b=KiLftkuCxl6NE0Z5GnOQXhoKfwhjNUBSCQAWnYyfLQ+LiSz8M2D9BnQlavUlJcqpj5 r2WBVfPMgec7ErXB7d/k7N1dWn9frQt9YfcR85U4NaYZ6A7c+n0cdKT+RFL174Krzqk2 lmXuheqYv1PgK+D/UjzvSTurKgMQjEi4xIS48= 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=6bZmvn6AnFCToftcYmbjrMBsBaTLLKSGSnwvFmZF6n0=; b=n1iSo8ifb5aXdtfvwAgOnWXfX1A2hMkBDN9NFil44j45jnEvaTsI0Y2VTCJONPEEsF xn4DMeQY1W+zVSUQd8Uqn74JvJ29rEsgnshKzIAR/WaUS9z9FQ10yiZxnUuCV7ntnBpg 2Lz0z4Bie43mw/BeDnEjRpTCzAlCLwXqwuJBGZhqVbfWTiuUrmPNrquDnumcJRQfZPnS /R2tQ99CSjGn8ngBMipU3Pr1caXM0SDHpZbVjh7C38gbjPa6a3kFoduBj0jyR5mLt1wh diNL0u1RWLno3XWcEgYcu6cgfJR1Dups6I5MR2rlboYynkHtckGd0Oz6gkYqPbgjRrak fcfw== X-Gm-Message-State: AOAM530Qdp6gQibMEsl89bK41Xvgi/99TD0VJ5Ra7JFaGdw5Bb1q4rSG TJ1ty0Ur29Kd7MwgCUetinhPaK3lEtjYqw== X-Received: by 2002:a2e:9784:: with SMTP id y4mr9939003lji.247.1600365120259; Thu, 17 Sep 2020 10:52:00 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id f6sm53457ljj.28.2020.09.17.10.51.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2020 10:51:58 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id x69so3153021lff.3 for ; Thu, 17 Sep 2020 10:51:58 -0700 (PDT) X-Received: by 2002:a19:8907:: with SMTP id l7mr9413968lfd.105.1600365117964; Thu, 17 Sep 2020 10:51:57 -0700 (PDT) MIME-Version: 1.0 References: <8bb582d2-2841-94eb-8862-91d1225d5ebc@MichaelLarabel.com> <0cbc959e-1b8d-8d7e-1dc6-672cf5b3899a@MichaelLarabel.com> <0daf6ae6-422c-dd46-f85a-e83f6e1d1113@MichaelLarabel.com> <20200912143704.GB6583@casper.infradead.org> <658ae026-32d9-0a25-5a59-9c510d6898d5@MichaelLarabel.com> In-Reply-To: From: Linus Torvalds Date: Thu, 17 Sep 2020 10:51:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Kernel Benchmarking To: Michael Larabel , Matthieu Baerts Cc: Matthew Wilcox , Amir Goldstein , "Ted Ts'o" , Andreas Dilger , Ext4 Developers List , Jan Kara , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Sep 14, 2020 at 10:47 AM Linus Torvalds wrote: > > (Note that it's a commit and has a SHA1, but it's from my "throw-away > tree for testing", so it doesn't have my sign-off or any real commit > message yet: I'll do that once it gets actual testing and comments). Just to keep the list and people who were on this thread informed: Michal ended up doing more benchmarking, and everything seems to line up and yes, that patch continues to work fine with a 'unfairness' value of 5. So I've committed it to my git tree (not pushed out yet, I have other pull requests etc I'm handling too), and we'll see if anybody can come up with a better model for how to avoid the page locking being such a pain. Or if somebody can figure out why fair locking causes problems for that packetdrill load that Matthieu reported. It does strike me that if the main source of contention comes from that "we need to check that the mapping is still valid as we insert the page into the page tables", then the page lock really isn't the obvious lock to use. It would be much more natural to use the mapping->i_mmap_rwsem, I feel. Willy? Your "just check for uptodate without any lock" patch itself feels wrong. That's what we do for plain reads, but the difference is that a read is a one-time event and a race is fine: we get valid data, it's just that it's only valid *concurrently* with the truncate or hole-punching event (ie either all zeroes or old data is fine). The reason faulting a page in is different from a read is that if you then map in a stale page, it might have had the correct contents at the time of the fault, but it will not have the correct contents going forward. So a page-in requires fundamentally stronger locking than a read() does, because of how the page-in causes that "future lifetime" of the page, in ways a read() event does not. But truncation that does page cache removal already requires that i_mmap_rwsem, and in fact the VM already very much uses that (ie when walking the page mapping). The other alternative might be just the mapping->private_lock. It's not a reader-writer lock, but if we don't need to sleep (and I don't think the final "check ->mapping" can sleep anyway since it has to be done together with the page table lock), a spinlock would be fine. Linus