Re: [PATCH v2] memcg: refactor mem_cgroup_resize_limit()

From: kbuild test robot
Date: Sun Jun 04 2017 - 17:13:00 EST


Hi Yu,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.12-rc3 next-20170602]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yu-Zhao/memcg-refactor-mem_cgroup_resize_limit/20170605-041444
base: git://git.cmpxchg.org/linux-mmotm.git master
config: x86_64-randconfig-x019-201723 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

mm/memcontrol.c: In function 'mem_cgroup_resize_limit':
>> mm/memcontrol.c:2453:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (inverted)
^~
mm/memcontrol.c:2455:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
ret = -EINVAL;
^~~
>> mm/memcontrol.c:2458:3: error: expected 'while' before 'if'
if (limit > counter->limit)
^~
>> mm/memcontrol.c:2464:4: error: break statement not within loop or switch
break;
^~~~~
mm/memcontrol.c:2428:7: warning: unused variable 'enlarge' [-Wunused-variable]
bool enlarge = false;
^~~~~~~
>> mm/memcontrol.c:2474:2: warning: no return statement in function returning non-void [-Wreturn-type]
} while (retry_count);
^
mm/memcontrol.c: At top level:
>> mm/memcontrol.c:2474:4: error: expected identifier or '(' before 'while'
} while (retry_count);
^~~~~
>> mm/memcontrol.c:2476:2: error: expected identifier or '(' before 'if'
if (!ret && enlarge)
^~
>> mm/memcontrol.c:2479:2: error: expected identifier or '(' before 'return'
return ret;
^~~~~~
>> mm/memcontrol.c:2480:1: error: expected identifier or '(' before '}' token
}
^

vim +2458 mm/memcontrol.c

2422
2423 static int mem_cgroup_resize_limit(struct mem_cgroup *memcg,
2424 unsigned long limit, bool memsw)
2425 {
2426 unsigned long curusage;
2427 unsigned long oldusage;
> 2428 bool enlarge = false;
2429 int retry_count;
2430 int ret;
2431 bool inverted;
2432 struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;
2433
2434 /*
2435 * For keeping hierarchical_reclaim simple, how long we should retry
2436 * is depends on callers. We set our retry-count to be function
2437 * of # of children which we should visit in this loop.
2438 */
2439 retry_count = MEM_CGROUP_RECLAIM_RETRIES *
2440 mem_cgroup_count_children(memcg);
2441
2442 oldusage = page_counter_read(counter);
2443
2444 do {
2445 if (signal_pending(current)) {
2446 ret = -EINTR;
2447 break;
2448 }
2449
2450 mutex_lock(&memcg_limit_mutex);
2451 inverted = memsw ? limit < memcg->memory.limit :
2452 limit > memcg->memsw.limit;
> 2453 if (inverted)
2454 mutex_unlock(&memcg_limit_mutex);
2455 ret = -EINVAL;
2456 break;
2457 }
> 2458 if (limit > counter->limit)
2459 enlarge = true;
2460 ret = page_counter_limit(counter, limit);
2461 mutex_unlock(&memcg_limit_mutex);
2462
2463 if (!ret)
> 2464 break;
2465
2466 try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL, !memsw);
2467
2468 curusage = page_counter_read(counter);
2469 /* Usage is reduced ? */
2470 if (curusage >= oldusage)
2471 retry_count--;
2472 else
2473 oldusage = curusage;
> 2474 } while (retry_count);
2475
> 2476 if (!ret && enlarge)
2477 memcg_oom_recover(memcg);
2478
> 2479 return ret;
> 2480 }
2481
2482 unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
2483 gfp_t gfp_mask,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip