From c359e13374e1d5c399b3e53c2270f7612f11d7dd Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Sat, 23 Aug 2014 16:53:30 +0800 Subject: [PATCH 16/23] x86_64: fix max_cpudata_limit() when offlined cpu exists When determining the largest cpudata limit for kmem_cache, the member, limit, of kmem_cache.array[NR_CPUS] is needed, and the process will stop when kmem_cache.array[cpu] equals to NULL. However, when offline cpus exist, kmem_cache.array[cpu] of offline cpus are NULL. Then the process of determining the largest cpudata limit will ignore the cpus after the offlined cpu. This patch is used to fix the above problem. Signed-off-by: Qiao Nuohan --- memory.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 8527483..01f0839 100755 --- a/memory.c +++ b/memory.c @@ -9106,7 +9106,13 @@ kmem_cache_s_array_nodes: "array cache array", RETURN_ON_ERROR)) goto bail_out; - for (i = max_limit = 0; (i < kt->cpus) && cpudata[i]; i++) { + for (i = max_limit = 0; i < kt->cpus; i++) { + if (check_offline_cpu(i)) + continue; + + if (!cpudata[i]) + break; + if (!readmem(cpudata[i]+OFFSET(array_cache_limit), KVADDR, &limit, sizeof(int), "array cache limit", RETURN_ON_ERROR)) { -- 1.8.5.3