Patchwork [v3] powerpc: use a kmem cache for DTL buffers

mail settings
Submitter Nishanth Aravamudan
Date April 14, 2011, 5:13 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/91185/
State Superseded
Headers show


Nishanth Aravamudan - April 14, 2011, 5:13 a.m.
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 H_REGISTER_VPA of the PAPR.
kmalloc does not guarantee an alignment of the allocation, though,
beyond 8 bytes (at least in my understanding). Create a special kmem
cache for DTL buffers with the alignment requirement.

Change from v1: removed extraneous #include.
Change from v2: instead of overallocating and aligning, use a kmem cache

Note, I initially put this in a firmware check if-block, but we have
also seen some issues with alignment with non-AMS partitions. The wasted
memory is unfortunate, though.

Signed-off-by: Nishanth Aravamudan <>
Cc: Paul Mackerras <>
Cc: Ben Herrenschmidt <>
Cc: Anton Blanchard <>

 arch/powerpc/platforms/pseries/setup.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 0007241..629b703 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -287,14 +287,17 @@  static int alloc_dispatch_logs(void)
 	int cpu, ret;
 	struct paca_struct *pp;
 	struct dtl_entry *dtl;
+	struct kmem_cache *dtl_cache;
 	if (!firmware_has_feature(FW_FEATURE_SPLPAR))
 		return 0;
+	dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES,
 	for_each_possible_cpu(cpu) {
 		pp = &paca[cpu];
-		dtl = kmalloc_node(DISPATCH_LOG_BYTES, GFP_KERNEL,
-				   cpu_to_node(cpu));
+		dtl = kmem_cache_alloc(dtl_cache, GFP_KERNEL);
 		if (!dtl) {
 			pr_warn("Failed to allocate dispatch trace log for cpu %d\n",