Hi,

Jeff Breidenbach:
> Filenames are like "msg1234567.html"
> 
> $ ls -U | wc
> 1600415 1600415 24506508
> 
> I would like to have a safety margin of 2X, because this directory will gro=
> w.

Ok.
I tried ubuntu 2.6.24-24-server kernel on my test machine and begin
thinking that the trigger of your problem MAY be memory
fragmentation. Because you have installed plenty of RAM and the kernel
log shows some bigger numbers as free pages, as long as those numbers
are correct and SLUB in ubuntu kernel is fine, the fragmentation MAY be
the cause (I may be wrong).
In your last kernel log, it showed the memory allocation for 1MB
failed. And now it failed 128KB allocation. It looks weird.

Anyway, VDIR in aufs does not suit for such large directory, because
VDIR builds dir blocks in memory which contain all entry names. It means
that when you readdir(3) to that dir, aufs allocates more than 24MB
memory in kernel space. Although the memory will be freed after several
seconds later closedir(3), allocating such large memory in kernel space
is not a good approach. I may be able to stop these messages by
specifying the __GFP_NOWARN flag, but it doesn't solve the problem. the
memory allocation failure will be still failure.

Currently I have a plan to address your problem.
- develop a new hook in user-space for readdir(3) as a shared object
  library.
- the hook will issue a 'raw' readdir/getdents request to aufs, merge
  the result, and build VDIR in user space.
- the raw request to aufs is equivalent to the direct readdir to the
  branch in aufs.
- you can specify the hook per process.
- you don't need to re-compile your binary, just specifying some
  environment variables.
- the performance may be damaged, but the memory consumption in kernel
  space is much less.
- in other words, move VDIR from kernel space to user space.

How do you think?


J. R. Okajima

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

Reply via email to