Re: LTP hugemmap05 test case failure on arm64 with linux-next (next-20190613)

From: Qian Cai
Date: Mon Jun 24 2019 - 17:30:44 EST


So the problem is that ipcget_public() has held the semaphore "ids->rwsem" for
too long seems unnecessarily and then goes to sleep sometimes due to direct
reclaim (other times LTP hugemmap05 [1] hasÂhugetlb_file_setup() returns
-ENOMEM),

[ÂÂ788.765739][ T1315] INFO: task hugemmap05:5001 can't die for more than 122
seconds.
[ÂÂ788.773512][ T1315] hugemmap05ÂÂÂÂÂÂRÂÂrunning taskÂÂÂÂ25600ÂÂ5001ÂÂÂÂÂÂ1
0x0000000d
[ÂÂ788.781348][ T1315] Call trace:
[ÂÂ788.784536][ T1315]ÂÂ__switch_to+0x2e0/0x37c
[ÂÂ788.788848][ T1315]ÂÂtry_to_free_pages+0x614/0x934
[ÂÂ788.793679][ T1315]ÂÂ__alloc_pages_nodemask+0xe88/0x1d60
[ÂÂ788.799030][ T1315]ÂÂalloc_fresh_huge_page+0x16c/0x588
[ÂÂ788.804206][ T1315]ÂÂalloc_surplus_huge_page+0x9c/0x278
[ÂÂ788.809468][ T1315]ÂÂhugetlb_acct_memory+0x114/0x5c4
[ÂÂ788.814469][ T1315]ÂÂhugetlb_reserve_pages+0x170/0x2b0
[ÂÂ788.819662][ T1315]ÂÂhugetlb_file_setup+0x26c/0x3a8
[ÂÂ788.824600][ T1315]ÂÂnewseg+0x220/0x63c
[ÂÂ788.828490][ T1315]ÂÂipcget+0x570/0x674
[ÂÂ788.832377][ T1315]ÂÂksys_shmget+0x90/0xc4
[ÂÂ788.836525][ T1315]ÂÂ__arm64_sys_shmget+0x54/0x88
[ÂÂ788.841282][ T1315]ÂÂel0_svc_handler+0x19c/0x26c
[ÂÂ788.845952][ T1315]ÂÂel0_svc+0x8/0xc

and then all other processes are waiting on the semaphore causes lock
contentions,

[ÂÂ788.849583][ T1315] INFO: task hugemmap05:5027 blocked for more than 122
seconds.
[ÂÂ788.857119][ T1315]ÂÂÂÂÂÂÂTainted: GÂÂÂÂÂÂÂÂWÂÂÂÂÂÂÂÂÂ5.2.0-rc6-next-20190624
#2
[ÂÂ788.864566][ T1315] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
disables this message.
[ÂÂ788.873139][ T1315] hugemmap05ÂÂÂÂÂÂD26960ÂÂ5027ÂÂÂ5026 0x00000000
[ÂÂ788.879395][ T1315] Call trace:
[ÂÂ788.882576][ T1315]ÂÂ__switch_to+0x2e0/0x37c
[ÂÂ788.886901][ T1315]ÂÂ__schedule+0xb74/0xf0c
[ÂÂ788.891136][ T1315]ÂÂschedule+0x60/0x168
[ÂÂ788.895097][ T1315]ÂÂrwsem_down_write_slowpath+0x5a0/0x8c8
[ÂÂ788.900653][ T1315]ÂÂdown_write+0xc0/0xc4
[ÂÂ788.904715][ T1315]ÂÂipcget+0x74/0x674
[ÂÂ788.908516][ T1315]ÂÂksys_shmget+0x90/0xc4
[ÂÂ788.912664][ T1315]ÂÂ__arm64_sys_shmget+0x54/0x88
[ÂÂ788.917420][ T1315]ÂÂel0_svc_handler+0x19c/0x26c
[ÂÂ788.922088][ T1315]ÂÂel0_svc+0x8/0xc

Ideally, it seems only ipc_findkey() and newseg() in this path needs to hold the
semaphore to protect concurrency access, so it could just be converted to a
spinlock instead.

[1] ./hugemmap05 -s -m

https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/mem/huget
lb/hugemmap/hugemmap05.c