[lkml]   [2002]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] 2.5.21 Nonlinear CPU support
At 09:06 12/06/02, Rusty Russell wrote:
>In message <> you write:
> > >Now, you *could* only allocate buffers for cpus where cpu_possible(i)
> > >is true, once the rest of the patch goes in. That would be a valid
> > >optimization.
> >
> > Please explain. What is cpu_possible()?
> >From Hotcpu/hotcpu-boot-i386.patch.gz:
>--- working-2.5.19-pre-hotcpu/include/asm-i386/smp.h Tue Jun 4
>15:37:09 2002
>+++ working-2.5.19-hotcpu/include/asm-i386/smp.h Mon Jun 3
>18:00:09 2002
>@@ -93,6 +94,8 @@
> #define smp_processor_id() (current_thread_info()->cpu)
> #define cpu_online(cpu) (cpu_online_map & (1<<(cpu)))
>+#define cpu_possible(cpu) (phys_cpu_present_map & (1<<(cpu)))
> extern inline unsigned int num_online_cpus(void)
> {
>ie. "Can this CPU number *ever* exist?", for exactly this kind of

Aha, now we are talking! This looks like it will restore the current memory
usage just fine.

> It looks like it was a mistake to leave that to a later
>patch, but I didn't appreciate the 64k-per-cpu buffer for NTFS (what
>is it for, by the way? per-cpu buffering for a filesystem seems, um,

It is used by the NTFS decompression engine. When implementing
decompression I went for using a single linear buffer holding the
compressed data to avoid having to switch pages midstream of memcpy()s
multi byte assignments, etc. (It could be argued that I was lazy but I
think it makes sense from a performance point of view.) After making that
decision I saw three choices:

1) Use a single buffer and lock it so once one file is under decompression
no other files can be and if multiple compressed files are being accessed
simultaneously on different CPUs only one CPU would be decompressing. The
others would be waiting for the lock. (Obviously scheduling and doing other

2) Use multiple buffers and allocate a buffer every time the decompression
engine is used. Note this means a vmalloc()+vfree() in EVERY ->readpage()
for a compressed file!

3) Use one buffer for each CPU and use a critical section during
decompression (disable preemption, don't sleep). Allocated at mount time of
first partition supporting compression. Freed at umount time of last
partition supporting compression.

I think it is obvious why I went for 3)...

Best regards,


"I've not lost my mind. It's backed up on tape somewhere." - Unknown
Anton Altaparmakov <aia21 at> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on
WWW: &

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:26    [W:0.066 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site