Received: by 10.223.164.221 with SMTP id h29csp57731wrb; Mon, 23 Oct 2017 17:54:43 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qfam3dG9VuC+2eclH0BTxRyt2M60RzmcMN7D5HwvuQ7jmuZFvBE5ggZM4mDuJZi+qDjkOu X-Received: by 10.159.252.7 with SMTP id n7mr11618332pls.355.1508806483778; Mon, 23 Oct 2017 17:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508806483; cv=none; d=google.com; s=arc-20160816; b=wuK1lAXQXs0PtZ+KLMcr3l8VIx0f1Wpzk52KkdtB5kJyYtIVE32zMyoiINWp6z0QTj S7RHOlSDvjWyZsFgHciVYHwcmTnpsjmBr9sP0hspx9F+01MMzosBx5LpGbaEBWiMwtdI sKayCKT4YBRQM1PR7uu5FE0tgw5HldHfJHXso6gxBQUr1vz7cSIYrdBQnteGxH5H6ipL tWeg79XXqVr4Jgbq+riwZ7gdURzyJiOIVqs3sNXONn5ANgO6tgAMsFcO+0j+6MBpi4Kt QB1MGV7cMmZdjxqBSNwN/Dk4Tj5SQdZO1gtrEwYFT4U7FyH8PtJXU0fi22I2Juq8HHlz 6P8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=GbPTAEpi0q+wRpemewvQbP+9jUh64hz7clDY5s8NZ8k=; b=QrlONJvqrZE3icY/8Vd7MmcVll06XSkRvCmeXtDl8uRaDruuLuco+RbV7raiTvqqN7 ozvXtri5/xsy6gSwDlxiDSSQfPDLnS30+jeZXTylrIuhPzEB0rc6xzzJ1yJuxwFv188z tXJDPXlFF54a0aNd4WmBUPq4V+AYoJ8hTDVGnDTSGfDGB5rt8bxcq9kufUyi+/HE201d QR96A7wJSL3TnfwLaVpFTpCanfzjBFieXR8GDRNh4vfZX3RB+MWlZVcCkJ4AEC/SHNBo 7nfidj+TzW5g+1s0TnDv52Q3mbokjkT3zEp4cYsLZXHC3gepo7nBVfEawbG6hj7QAQL+ yPvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 98si4666073plt.495.2017.10.23.17.54.29; Mon, 23 Oct 2017 17:54:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbdJXAyD (ORCPT + 99 others); Mon, 23 Oct 2017 20:54:03 -0400 Received: from mga11.intel.com ([192.55.52.93]:56909 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbdJXAyB (ORCPT ); Mon, 23 Oct 2017 20:54:01 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2017 17:54:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,424,1503385200"; d="scan'208";a="1209214627" Received: from kemi-desktop.sh.intel.com (HELO [10.239.13.103]) ([10.239.13.103]) by fmsmga001.fm.intel.com with ESMTP; 23 Oct 2017 17:53:59 -0700 Subject: Re: [PATCH] buffer: Avoid setting buffer bits that are already set To: Jens Axboe , Jan Kara , Darrick J Wong , Eric Biggers , Andreas Gruenbacher , Jeff Layton Cc: Dave , Andi Kleen , Tim Chen , Ying Huang , Aaron Lu , Linux Kernel References: <1508772444-27879-1-git-send-email-kemi.wang@intel.com> From: kemi Message-ID: Date: Tue, 24 Oct 2017 08:52:22 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年10月24日 00:19, Jens Axboe wrote: > On 10/23/2017 10:27 AM, Kemi Wang wrote: >> It's expensive to set buffer flags that are already set, because that >> causes a costly cache line transition. >> >> A common case is setting the "verified" flag during ext4 writes. >> This patch checks for the flag being set first. >> >> With the AIM7/creat-clo benchmark testing on a 48G ramdisk based-on ext4 >> file system, we see 3.3%(15431->15936) improvement of aim7.jobs-per-min on >> a 2-sockets broadwell platform. >> >> What the benchmark does is: it forks 3000 processes, and each process do >> the following: >> a) open a new file >> b) close the file >> c) delete the file >> until loop=100*1000 times. >> >> The original patch is contributed by Andi Kleen. > > We discussed this recently, in reference to this commit: > > commit 7fcbbaf18392f0b17c95e2f033c8ccf87eecde1d > Author: Jens Axboe > Date: Thu May 22 11:54:16 2014 -0700 > > mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT > > which made a massive difference, as the changelog details. > > blk-mq uses this extensively as well, where possible. The problem is > that it always has to be explained, hence the recent discussion was > around perhaps adding > > set_bit_if_not_set() > clear_bit_if_set() > > or similar functions, to document in a single location why this matters. > Additionally, some archs may be able to implement that in an efficient > manner. > > You can add my reviewed-by to the below, Thanks. I'll see if I can find some > time to implement the above in a nice way. Agree. Maybe something like test_and_set_bit() would be more suitable. In the mean time, you may > want to consider adding a comment to the function explaining why you > have done it that way. > Sure. From 1582065922418270496@xxx Mon Oct 23 16:20:37 +0000 2017 X-GM-THRID: 1582062716863867471 X-Gmail-Labels: Inbox,Category Forums