From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760186AbYDVO4s (ORCPT ); Tue, 22 Apr 2008 10:56:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751007AbYDVO4j (ORCPT ); Tue, 22 Apr 2008 10:56:39 -0400 Received: from smtp2a.orange.fr ([80.12.242.139]:25302 "EHLO smtp2a.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbYDVO4i convert rfc822-to-8bit (ORCPT ); Tue, 22 Apr 2008 10:56:38 -0400 X-ME-UUID: 20080422145636729.B21B9700005C@mwinf2a14.orange.fr Message-ID: <480DFC8A.8040105@cosmosbay.com> Date: Tue, 22 Apr 2008 16:56:10 +0200 From: Eric Dumazet User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 To: Andrea Arcangeli Cc: Christoph Lameter , Nick Piggin , Jack Steiner , Peter Zijlstra , kvm-devel@lists.sourceforge.net, Kanoj Sarcar , Roland Dreier , Steve Wise , linux-kernel@vger.kernel.org, Avi Kivity , linux-mm@kvack.org, Robin Holt , general@lists.openfabrics.org, Hugh Dickins , akpm@linux-foundation.org, Rusty Russell Subject: Re: [PATCH 01 of 12] Core of mmu notifiers References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrea Arcangeli a écrit : > + > +static int mm_lock_cmp(const void *a, const void *b) > +{ > + cond_resched(); > + if ((unsigned long)*(spinlock_t **)a < > + (unsigned long)*(spinlock_t **)b) > + return -1; > + else if (a == b) > + return 0; > + else > + return 1; > +} > + This compare function looks unusual... It should work, but sort() could be faster if the if (a == b) test had a chance to be true eventually... static int mm_lock_cmp(const void *a, const void *b) { unsigned long la = (unsigned long)*(spinlock_t **)a; unsigned long lb = (unsigned long)*(spinlock_t **)b; cond_resched(); if (la < lb) return -1; if (la > lb) return 1; return 0; }