Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965173Ab2JDO2b (ORCPT ); Thu, 4 Oct 2012 10:28:31 -0400 Received: from m199-177.yeah.net ([123.58.177.199]:42822 "EHLO m199-177.yeah.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965031Ab2JDO2a convert rfc822-to-8bit (ORCPT ); Thu, 4 Oct 2012 10:28:30 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\)) Subject: Re: [PATCH] btrfs ulist use rbtree instead From: Zimilo In-Reply-To: <506D5A60.6040208@gmx.net> Date: Thu, 4 Oct 2012 22:28:33 +0800 Cc: Zimilo , chris.mason@fusionio.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <2793AF96-98CE-4709-94EE-659D853267E4@code-trick.com> References: <1349341866-29320-1-git-send-email-zimilo@code-trick.com> <20121004092644.GB14582@twin.jikos.cz> <506D5A60.6040208@gmx.net> To: Arne Jansen X-Mailer: Apple Mail (2.1485) X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQUhVTU5CQkJCQ09MT0pJSktCT1dZCQ4XHghZQVkoKz0kLz42KyQ#KSk0 KSQyNSQzPjo*PilBS1VLQDYjJDU0JDI1JDM#Oj8#KUFOVUtAKy8pJDU0JDI1JDM#Oj8#KUFJVUtA PyI1OjYyOCQyKyQ1NCQyNSQzPjo*PilBS1VLQDYuNy8yJCk4Ky8kPzI9PT4pPjUvJDI1JDM#Oj8# KUFJVUtAMiskLzQ*OiIkODUvJEskSktLQUtVS0AyKyRKJDM0LikkODUvJEskSktLQUtVS0AyKyRO JDYyNS4vPiQ4NS8kSyRKS0FLVUtAMiskSiQ2MjUuLz4kODUvJEskSktBS1VLQDIrJEhLJDYyNS4v PiQ4NS8kSyROS0FLVUtAPTUkNjoiJE9KQiQzNzEkSiRLQ0tIS09BS1VISEA9KyQpPiQ9LCQzNzEk S0NLSEtNQVZMVU5AKC45JD5BSlVOTkA9NSQoLjkkPjUsNCk*KCQzNzEkSktLSUtKQUtVSUNAPTUk NjoiJE9KQiQzNzEkSSRLQ0tIS09BS1VLWQY+ X-HM-Sender-Digest: e1kSHx4VD1lBWUc6NTo6Fjo*DTo5FFE*MyEWMBoCOh8KCT5VSlVKSE9CSE1LQktMT0pDVTMWGhIX VQESFhIXFDsYFB8eVg8JEhgQVRgUFkVZV1kMHhlZQR0aFwgeBg++ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2751 Lines: 77 Detailed explanations for the patch: When the small inline cache is exhausted, created a new rbtree, and the new rbtree uses original spaces the inline nodes placed for saving memory. By using the rbtree can gain a better performance when nnodes gets larger. Sorry for I doest't did much more measurements, but the average lookup time increases slower then the original linear policy when nnodes goes larger. For this is my first patch I submitted, I'm too excited to find something I can hack the kernel, however I didn't consider the whole thing. I will continue to dive into the btrfs implementation, and work harder. :-) - Rock On 2012-10-4, at 下午5:44, Arne Jansen wrote: > On 04.10.2012 11:26, David Sterba wrote: >>> @@ -207,16 +266,23 @@ EXPORT_SYMBOL(ulist_add); >>> * end is reached. No guarantee is made with respect to the order in which >>> * the elements are returned. They might neither be returned in order of >>> * addition nor in ascending order. >>> - * It is allowed to call ulist_add during an enumeration. Newly added items >>> - * are guaranteed to show up in the running enumeration. >>> */ >>> struct ulist_node *ulist_next(struct ulist *ulist, struct ulist_iterator *uiter) >> >> Quick observation: >> >> If there's code relying on the behaviour stated in the removed part of >> the comment, it will break. Have you verified this is not the case? > > It's a good thing to use rb-trees when the small inline cache is exhausted, > but of course it should keep the semantics. We heavily rely on the removed > part. > It should be possible to keep the semantics if the elements are also kept > in a linked list. As it inflates the size of struct ulist_node even more, > it might make sense to use a smaller struct for the inline cache to keep > the footprint low. > > Also, a commit message might be good that explains the motivation for the > change. Have you done any measurements? > > Thanks for working on this. > > -Arne > >> >> >> david >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > 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/ -- 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/