LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Tomas M <tomas@slax.org>, linux-kernel@vger.kernel.org
Subject: Re: max_loop limit
Date: Thu, 22 Mar 2007 14:42:31 +0100	[thread overview]
Message-ID: <20070322134230.GP19922@kernel.dk> (raw)
In-Reply-To: <20070322144210.73dfaf83.dada1@cosmosbay.com>

On Thu, Mar 22 2007, Eric Dumazet wrote:
> On Thu, 22 Mar 2007 12:37:54 +0100
> Tomas M <tomas@slax.org> wrote:
> 
> > The question is not "Why do we need more than 255 loops?".
> > The question should be "Why do we need the hardcoded 255-limit in kernel 
> > while there is no reason for it at all?"
> > 
> > My patch simply removes the hardcoded limitation.
> 
> Hello Tomas, welcome !
> 
> Well, its an attempt to remove a hardcoded limit, but as you said in the Changelog, it really depends on kmalloc() being able to allocate a large continous memory zone. Alas it might fail.
> The golden rule is to avoid all allocations larger than PAGE_SIZE :)
> 
> On x86_64, sizeof(struct loop_device) is 368, so the 'new limit' would be 356 instead of 256...
> 
> You might want a more radical patch : 
> 
> 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 :)

But this still wastes memory, why not just allocate each loop device
dynamically when it is set up? The current approach is crap, it is just
wasting memory for loop devices, queues, etc.

-- 
Jens Axboe


  reply	other threads:[~2007-03-22 13:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22  7:57 Tomas M
2007-03-22 11:00 ` markus reichelt
2007-03-22 11:37   ` Tomas M
2007-03-22 13:42     ` Eric Dumazet
2007-03-22 13:42       ` Jens Axboe [this message]
2007-03-22 13:52         ` Eric Dumazet
2007-03-22 13:54           ` Jens Axboe
2007-03-22 14:11             ` William Lee Irwin III
2007-03-22 15:22               ` Arjan van de Ven
2007-03-22 16:09               ` Pádraig Brady
2007-03-28 23:34                 ` Karel Zak
     [not found]             ` <20070322151826.c1421851.dada1@cosmosbay.com>
     [not found]               ` <20070322142306.GU19922@kernel.dk>
     [not found]                 ` <20070322153603.1f5d442d.dada1@cosmosbay.com>
2007-03-22 15:31                   ` max_loop limit - paid job offer Tomas M
2007-03-22 14:33         ` max_loop limit Al Viro
2007-03-22 19:51           ` Olivier Galibert
2007-03-22 14:25       ` Tomas M
2007-03-23  1:34       ` Jan Engelhardt
2007-03-23 23:26         ` [PATCH] " Jan Engelhardt
2007-03-25  0:17           ` Ken Chen
2007-03-25  0:29           ` Ken Chen
2007-03-25  8:40           ` Tomas M
2007-03-28 23:41             ` Karel Zak
2007-03-29  3:54           ` Kyle Moffett
2007-03-29  4:16             ` [PATCH] max_loop limit, t2 Jan Engelhardt
2007-03-29  8:38               ` [PATCH] max_loop limit, loop.c final working version Tomas M
2007-03-29 14:16     ` max_loop limit Bill Davidsen
2007-03-22 13:53 devzero
2007-03-22 23:23 devzero
2007-03-23  8:59 ` Tomas M
2007-03-22 23:37 roland
2007-03-29 14:20 ` Bill Davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070322134230.GP19922@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=dada1@cosmosbay.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomas@slax.org \
    --subject='Re: max_loop limit' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).