mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ulrich Drepper <drepper@redhat.com>
Subject: Re: [patch 1/2] ufd v1 - unsequential O(1) fdmap core
Date: Mon, 4 Jun 2007 05:55:42 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0706040523150.30231@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <20070604122857.1399e3fc.dada1@cosmosbay.com>

On Mon, 4 Jun 2007, Eric Dumazet wrote:

> Goals :
> 1) libc wants 'private fds'
> 2) Latencies of get_unused_fd() for huge processes (more than 100.000 file handles)
> 
> Point 1) can use a top-down allocation, or use a 'last unused' index.
> 
> 
> Point 2) Instead of introducing a *complex* layer, couldnt we improve existing one ?

Complex layer?! It's an array with free slots chained by a double linked 
list.


> If the main problem we want to solve is the potentially slow bitmap 
> search, 
> we could logically divide the open_fds bitmap into pages (4096*8 = 32768 
> bits per page on i386/x86_64 arches)
> 
> We would have to add a new field in 'struct fdtable', pointer to an 
> array of u32 counters, that would count the number of 'one' bits in each 
> PAGE. This array is tiny : 128 bytes only for 1.000.000 file handles
> 
> get_unused_fd() could then use this array to select an appropriate page 
> (a page known to have at least one zero bit), then do a 
> find_next_zero_bit() restricted to at most PAGE_SIZE bytes. Max latency 
> would be similar to vm one when clearing a page. If applications use 
> Point 1) hint (asking kernel one fd, not the POSIX low fd), typical 
> latency will be null.

And look at what you're describing here, talking about simplicity. You'd 
still need two bitmaps, so you'd still need the out-of-fdmap.c/h code. 
You're trying to fit an horse-shoe to a deer :)
The most appropriate structure for this, is an array (O(1) lookup) with 
free elements chained by a dbl linked list (O(1) alloc and free). Plus, 
the extra pointer can nicely fit other per-allocated-fd flags w/out adding 
extra custom flags bitmaps to the fdtable.



- Davide



  reply	other threads:[~2007-06-04 12:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02 22:59 Davide Libenzi
2007-06-03 21:19 ` Eric Dumazet
2007-06-03 22:51   ` Davide Libenzi
2007-06-04  6:08     ` Andrew Morton
2007-06-04  8:05       ` Ingo Molnar
2007-06-04  8:09         ` Ingo Molnar
2007-06-04  8:34           ` Andrew Morton
2007-06-04  8:42             ` Ingo Molnar
2007-06-04  8:47               ` Andrew Morton
2007-06-04 13:05                 ` Davide Libenzi
2007-06-04 13:30                   ` Davide Libenzi
2007-06-04 16:56                   ` Andrew Morton
2007-06-04 17:57                     ` Davide Libenzi
2007-06-04 10:28             ` Eric Dumazet
2007-06-04 12:55               ` Davide Libenzi [this message]
2007-06-04 13:25                 ` Eric Dumazet
2007-06-04 13:33                   ` Davide Libenzi
2007-06-04 13:35                   ` Davide Libenzi
2007-06-04 14:28                     ` Eric Dumazet
2007-06-04 14:53                       ` Davide Libenzi
2007-06-04 14:12                   ` Ingo Molnar
2007-06-04 14:27                     ` Eric Dumazet
2007-06-05 20:37                       ` Ingo Molnar
2007-06-05 20:50                         ` Thomas Gleixner
2007-06-05 20:57                         ` Eric Dumazet
2007-06-05 22:29                         ` Eric Dumazet

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=Pine.LNX.4.64.0706040523150.30231@alien.or.mcafeemobile.com \
    --to=davidel@xmailserver.org \
    --cc=akpm@linux-foundation.org \
    --cc=dada1@cosmosbay.com \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®