[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.61.0703230232320.9555@yvahk01.tjqt.qr>
Date: Fri, 23 Mar 2007 02:34:04 +0100 (MET)
From: Jan Engelhardt <jengelh@...ux01.gwdg.de>
To: Eric Dumazet <dada1@...mosbay.com>
cc: Tomas M <tomas@...x.org>, linux-kernel@...r.kernel.org
Subject: Re: max_loop limit
On Mar 22 2007 14:42, Eric Dumazet wrote:
>Instead of using :
>
>static struct loop_device *loop_dev;
>loop_dev = kmalloc(max_loop * sizeof(struct loop_device));
>
>Switch to :
>
>static struct loop_device **loop_dev;
>loop_dev = kmalloc(max_loop * sizeof(void *));
>if (!loop_dev) rollback...
>for (i = 0 ; i < max_loop ; i++) {
> loop_dev[i] = kmalloc(sizeof(struct loop_device));
> if (!loop_dev[i]) rollback...
>}
>
>This time, you would be limited to 16384 loop devices on x86_64, 32768 on i386
>:)
Oh noes. Please use a linked list (kmalloc cope = perfect) if you really need
loads of loopdevs. Sorta
struct loopdev {
struct list_head lh;
int lo_number;
};
to keep the /dev/loop%d number consistent across loopdev removal.
Maybe it's better to even use an rbtree (linked list does not scale to it).
Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists