lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 8 Jun 2008 16:00:12 +1000 From: Rusty Russell <rusty@...tcorp.com.au> To: Eric Dumazet <dada1@...mosbay.com> Cc: Mike Travis <travis@....com>, Christoph Lameter <clameter@....com>, Andrew Morton <akpm@...ux-foundation.org>, linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org, David Miller <davem@...emloft.net>, Peter Zijlstra <peterz@...radead.org> Subject: Re: [patch 00/41] cpu alloc / cpu ops v3: Optimize per cpu access On Friday 06 June 2008 15:33:22 Eric Dumazet wrote: > 1) NUMA case > > For a 64 bit NUMA arch, chunk size of 2Mbytes > > Allocates 2Mb for each possible processor (on its preferred memory > node), and compute values to setup offset_of_cpu[NR_CPUS] array. > > Chunk 0 > CPU 0 : virtual address XXXXXX > CPU 1 : virtual address XXXXXX + offset_of_cpu[1] > ... > CPU n : virtual address XXXXXX + offset_of_cpu[n] > + a shared bitmap > > > For next chunks, we could use vmalloc() zone to find > nr_possible_cpus virtual addresses ranges where you can map > a 2Mb page per possible cpu, as long as we respect the relative > delta between each cpu block, that was computed when > chunk 0 was setup. > > Chunk 1..n > CPU 0 : virtual address YYYYYYYYYYYYYY > CPU 1 : virtual address YYYYYYYYYYYYYY + offset_of_cpu[1] > ... > CPU n : virtual address YYYYYYYYYYYYYY + offset_of_cpu[n] > + a shared bitmap (32Kbytes if 8 bytes granularity in allocator) > > For a variable located in chunk 0, its 'address' relative to current > cpu %gs will be some number between [0 and 2^20-1] > > For a variable located in chunk 1, its 'address' relative to current > cpu %gs will be some number between > [YYYYYYYYYYYYYY - XXXXXX and YYYYYYYYYYYYYY - XXXXXX + 2^20 - 1], > not necessarly [2^20 to 2^21 - 1] > > > Chunk 0 would use normal memory (no vmap TLB cost), only next ones need > vmalloc(). > > So the extra TLB cost would only be taken for very special NUMA setups > (only if using a lot of percpu allocations) > > Also, using a 2Mb page granularity probably wastes about 2Mb per cpu, but > this is nothing for NUMA machines :) If you're prepared to have mappings for chunk 0, you can simply make it virtually linear and creating a new chunk is simple. If not, you need to reserve the virtual address space(s) for future mappings. Otherwise you're unlikely to get the same layout for allocations. This is not a show-stopper: we've lived with limited vmalloc room since forever. It just has to be sufficient. Otherwise, your analysis is correct, if a little verbose :) Cheers, Rusty. -- 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