Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753593Ab3HLUKw (ORCPT ); Mon, 12 Aug 2013 16:10:52 -0400 Received: from mga02.intel.com ([134.134.136.20]:40623 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752317Ab3HLUKs (ORCPT ); Mon, 12 Aug 2013 16:10:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,864,1367996400"; d="scan'208";a="361541736" Subject: Re: Performance regression from switching lock to rw-sem for anon-vma tree From: Tim Chen To: Ingo Molnar Cc: Davidlohr Bueso , Peter Zijlstra , Ingo Molnar , Andrea Arcangeli , Mel Gorman , "Shi, Alex" , Andi Kleen , Andrew Morton , Michel Lespinasse , Davidlohr Bueso , "Wilcox, Matthew R" , Dave Hansen , Rik van Riel , linux-kernel@vger.kernel.org, linux-mm In-Reply-To: <20130812185247.GA20451@gmail.com> References: <20130629071245.GA5084@gmail.com> <1372710497.22432.224.camel@schen9-DESK> <20130702064538.GB3143@gmail.com> <1373997195.22432.297.camel@schen9-DESK> <20130723094513.GA24522@gmail.com> <20130723095124.GW27075@twins.programming.kicks-ass.net> <20130723095306.GA26174@gmail.com> <1375143209.22432.419.camel@schen9-DESK> <1375833325.2134.36.camel@buesod1.americas.hpqcorp.net> <1375836988.22432.435.camel@schen9-DESK> <20130812185247.GA20451@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 12 Aug 2013 13:10:50 -0700 Message-ID: <1376338250.22432.440.camel@schen9-DESK> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-1.fc14) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2346 Lines: 53 On Mon, 2013-08-12 at 20:52 +0200, Ingo Molnar wrote: > * Tim Chen wrote: > > > On Tue, 2013-08-06 at 16:55 -0700, Davidlohr Bueso wrote: > > > > > I got good numbers, recovering the performance drop I noticed with the > > > i_mmap_mutex to rwsem patches. > > > > That's good. I remembered that the earlier version of the patch not > > only recovered the performance drop, but also provide some boost when > > you switch from i_mmap_mutex to rwsem for aim7. Do you see similar > > boost with this version? > > > > > Looking forward to a more upstreamable > > > patchset that deals with this work, including the previous patches. > > > > > > One thing that's bugging me about this series though is the huge amount > > > of duplicated code being introduced to rwsems from mutexes. We can share > > > common functionality such as mcs locking (perhaps in a new file under > > > lib/), can_spin_on_owner() and owner_running(), perhaps moving those > > > functions into sheduler code, were AFAIK they were originally. > > > > I think that MCS locking is worth breaking out as its > > own library. After we've done that, the rest of > > the duplication are minimal. It is easier > > to keep them separate as there are some rwsem > > specific logic that may require tweaking > > to can_spin_on_owner and owner_running. > > That's what I would strongly suggest to be the approach of these patches: > first the MCS locking factoring out, then changes in rwsem behavior. > > I'd suggest the librarization should be done using inlines or so, so that > we don't touch the current (pretty good) mutex.o code generation. I.e. > code library only on the source code level. > > Done that way we could also apply the librarization first, without having > to worry about performance aspects. Having the code shared will also make > sure that an improvement to the mutex slowpaths automatically carries over > into rwems and vice versa. Ingo and Davidlohr, Thanks for your feedbacks. I'll spin off a set of new patches to incorporate your suggestions later. Tim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/