Message ID | 1302733988-23037-1-git-send-email-nacc@us.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Wed, 2011-04-13 at 15:33 -0700, Nishanth Aravamudan wrote: > PAPR specifies that DTL buffers can not cross AMS environments (aka CMO > in the PAPR) and can not cross a memory entitlement granule boundary > (4k). This is found in section 14.11.3.2 H_REGISTER_VPA of the PAPR. > kmalloc does not guarantee an alignment of the allocation, though, > beyond 8 bytes (at least in my understanding). Over-allocate and align > the resulting address. You can specify alignment by creating your own kmem_cache, ie. kmem_cache_create(). Obviously there will be some overhead to create the cache structure, but I'd think it will be less than 4k * NR_CPUs. cheers
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 0007241..a67be48 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -293,14 +293,15 @@ static int alloc_dispatch_logs(void) for_each_possible_cpu(cpu) { pp = &paca[cpu]; - dtl = kmalloc_node(DISPATCH_LOG_BYTES, GFP_KERNEL, - cpu_to_node(cpu)); + dtl = kmalloc_node(DISPATCH_LOG_BYTES + DISPATCH_LOG_BYTES - 1, + GFP_KERNEL, cpu_to_node(cpu)); if (!dtl) { pr_warn("Failed to allocate dispatch trace log for cpu %d\n", cpu); pr_warn("Stolen time statistics will be unreliable\n"); break; } + dtl = PTR_ALIGN(dtl, DISPATCH_LOG_BYTES); pp->dtl_ridx = 0; pp->dispatch_log = dtl;