Received: by 10.223.176.5 with SMTP id f5csp449144wra; Fri, 2 Feb 2018 00:10:40 -0800 (PST) X-Google-Smtp-Source: AH8x2240WUJOxPAk2Xz0B364WC3nfVfwWLJGaEt0nhnhTvqjZo6TyHI7+BSqFVT118rO4MJdR3o0 X-Received: by 10.98.157.211 with SMTP id a80mr39270819pfk.242.1517559040088; Fri, 02 Feb 2018 00:10:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517559040; cv=none; d=google.com; s=arc-20160816; b=yCPbVVKmEMKeJ5e/BTs9zzGMQNefye5UWwCYAatCKe5GK/0AE73onoc60OdUjSyhUy PsMtgFHiVN6U/ba5zLAqDcYue14v/k92G+gqiuXZY/Xyr1GimfQbsHXjxmGqjyWyC1SY 3jSO+/1Fc+iNo4uOhIcPOf+yAQg17zX6yq9myCUZVebpNusuYLNdq9KwjBq02bqtvQT3 7H2RL+XbH99psoF0lvAp1yRp1kKI11aOiQKCTlvbGz35s5M05pIcO2mJc4sT1YezEJfq hpukWvZKBtYVj4Ti9Bczpg2ZYtaICQXkhx4aUIjvxQv2TKx+A5flUBcpi2XTi7k4Y6vQ qltg== 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:references:cc:to:from:subject:arc-authentication-results; bh=exHQg5vBv0v45vUV90o4Sp6pdhInyfJKYKH9hbYzfmA=; b=NdERxfmgtGmk408hqHNT97kIIP1ugx1TM3zrNHQ69u5sUKPtAe1gwGjv4pi7GaLTz1 PdWExpJ03W4B+WJg2aV/Z0++ld2bM3SLt9aFQNV61Rl7Nx8SHHMrqatpjGbDPttdo+bL Or2a7sYDsL5SZ9x3T3qDB+v7tPAxhUpO+wIAx5vcIiJWx8EqBx4kCtsKmT05njSNuN9z vtXWSEznDRJlOneDHUkQQNP9Cy6D1pQRHxChsskGpDZyE/gHnhSUpv2sVBn74XDV/H9B DAvhg43wFSkCqk7GAH7nupv6dkBmO1hTmVsyqham2lV0Zt/Uy5r8gFuUltL1KgrErWck 4M2Q== 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 a89-v6si1333177pla.524.2018.02.02.00.10.23; Fri, 02 Feb 2018 00:10:40 -0800 (PST) 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 S1751606AbeBBIJq (ORCPT + 99 others); Fri, 2 Feb 2018 03:09:46 -0500 Received: from mga05.intel.com ([192.55.52.43]:19240 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbeBBIJj (ORCPT ); Fri, 2 Feb 2018 03:09:39 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 00:09:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,447,1511856000"; d="scan'208";a="27483279" Received: from kemi-desktop.sh.intel.com (HELO [10.239.13.119]) ([10.239.13.119]) by fmsmga001.fm.intel.com with ESMTP; 02 Feb 2018 00:09:37 -0800 Subject: Re: [PATCH v2] buffer: Avoid setting buffer bits that are already set From: kemi To: Jan Kara , Jens Axboe , Darrick J Wong , Eric Biggers , Andreas Gruenbacher , Jeff Layton Cc: Dave , Andi Kleen , Tim Chen , Ying Huang , linux-block , Linux Kernel References: <1508807802-9691-1-git-send-email-kemi.wang@intel.com> Message-ID: <6e946728-23f5-d5df-c8d0-c9ec4251557c@intel.com> Date: Fri, 2 Feb 2018 16:07:28 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.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 Hi, Jens Could you help to merge this patch to your tree? Thanks On 2017年11月03日 10:29, kemi wrote: > > > On 2017年10月24日 09:16, 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. >> >> Signed-off-by: Andi Kleen >> Signed-off-by: Kemi Wang >> Tested-by: Kemi Wang >> Reviewed-by: Jens Axboe >> --- > > Seems that this patch is still not merged. Anything wrong with that? thanks > >> include/linux/buffer_head.h | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h >> index c8dae55..211d8f5 100644 >> --- a/include/linux/buffer_head.h >> +++ b/include/linux/buffer_head.h >> @@ -80,11 +80,14 @@ struct buffer_head { >> /* >> * macro tricks to expand the set_buffer_foo(), clear_buffer_foo() >> * and buffer_foo() functions. >> + * To avoid reset buffer flags that are already set, because that causes >> + * a costly cache line transition, check the flag first. >> */ >> #define BUFFER_FNS(bit, name) \ >> static __always_inline void set_buffer_##name(struct buffer_head *bh) \ >> { \ >> - set_bit(BH_##bit, &(bh)->b_state); \ >> + if (!test_bit(BH_##bit, &(bh)->b_state)) \ >> + set_bit(BH_##bit, &(bh)->b_state); \ >> } \ >> static __always_inline void clear_buffer_##name(struct buffer_head *bh) \ >> { \ >>