From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f175.google.com ([209.85.192.175]:35786 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbdFCFoU (ORCPT ); Sat, 3 Jun 2017 01:44:20 -0400 Received: by mail-pf0-f175.google.com with SMTP id n23so60560100pfb.2 for ; Fri, 02 Jun 2017 22:44:19 -0700 (PDT) Date: Fri, 2 Jun 2017 22:44:08 -0700 From: Eric Biggers To: Christoph Lameter Cc: akpm@linux-foundation.org, viro@zeniv.linux.org.uk, mm-commits@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: + fs-bufferc-make-bh_lru_install-more-efficient.patch added to -mm tree Message-ID: <20170603054408.GA12796@google.com> References: <592f4959.hf6G/WhBeHpccHb7%akpm@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: +Cc linux-fsdevel On Thu, Jun 01, 2017 at 11:07:19AM -0500, Christoph Lameter wrote: > On Wed, 31 May 2017, akpm@linux-foundation.org wrote: > > > + struct buffer_head *evictee = bh; > > + struct bh_lru *b; > > + int i; > > + b = this_cpu_ptr(&bh_lrus); > > + for (i = 0; i < BH_LRU_SIZE; i++) { > > + swap(evictee, b->bhs[i]); > > Could you try to use this_cpu_xchg here to see if it reduces latency > further? > > for (i = 0; i < BH_LRU_SIZE; i++) { > __this_cpu_xchg(bh_lrus->bhs[i], evictee) > > ... > I tried --- actually, 'evictee = __this_cpu_xchg(bh_lrus.bhs[i], evictee)'. But it's much slower, nearly as slow as the original --- which perhaps is not surprising since __this_cpu_xchg() is a cmpxchg rather than a simple load and store. It may be even worse on non-x86 architectures. Also note that we still have to disable IRQs because we need to stay on the same CPU throughout so that only a single queue is operated on. Eric