Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751970Ab2H1RF7 (ORCPT ); Tue, 28 Aug 2012 13:05:59 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:47963 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214Ab2H1RF5 (ORCPT ); Tue, 28 Aug 2012 13:05:57 -0400 MIME-Version: 1.0 In-Reply-To: References: <1340736849-14875-1-git-send-email-yinghai@kernel.org> <1340736849-14875-3-git-send-email-yinghai@kernel.org> From: Linus Torvalds Date: Tue, 28 Aug 2012 10:05:35 -0700 X-Google-Sender-Auth: xneGrcN6zZ6HdJPWaOtMoM_ndFs Message-ID: Subject: Re: [PATCH -v12 02/15] resources: Add probe_resource() To: Yinghai Lu Cc: Bjorn Helgaas , Benjamin Herrenschmidt , Tony Luck , David Miller , x86 , Dominik Brodowski , Andrew Morton , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 776 Lines: 19 On Tue, Aug 28, 2012 at 9:09 AM, Yinghai Lu wrote: > > please check update one. -v7 Ugh. Ok, looking closer at this, I think I agree with Bjorn. This is too ugly. The whole "reduce size/needed_size by 1" double loop is O(n**2). And it does ugly "insert fake resource to check, and then remove it". Ugh. Maybe this works in practice for the special case of some PCI bus numbers that are small integers, but the code is nasty nasty horrible and not a generic resource allocation thing. Linus -- 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/