From patchwork Tue Aug 20 09:48:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 11103479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CF0514DE for ; Tue, 20 Aug 2019 09:49:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 21C462339E for ; Tue, 20 Aug 2019 09:49:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21C462339E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 12E306B000A; Tue, 20 Aug 2019 05:49:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0B8A36B000C; Tue, 20 Aug 2019 05:49:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE7A56B000D; Tue, 20 Aug 2019 05:49:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0046.hostedemail.com [216.40.44.46]) by kanga.kvack.org (Postfix) with ESMTP id C81FA6B000A for ; Tue, 20 Aug 2019 05:49:38 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 74C31256FF for ; Tue, 20 Aug 2019 09:49:38 +0000 (UTC) X-FDA: 75842334036.28.rice06_53ffddc471b27 X-Spam-Summary: 2,0,0,ffea63e6ff38d9bb,d41d8cd98f00b204,alex.shi@linux.alibaba.com,:cgroups@vger.kernel.org:linux-kernel@vger.kernel.org::akpm@linux-foundation.org:mgorman@techsingularity.net:tj@kernel.org:alex.shi@linux.alibaba.com,RULES_HIT:41:69:152:355:379:541:973:988:989:1260:1261:1277:1311:1313:1314:1345:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:1801:2197:2199:2393:2559:2562:3138:3139:3140:3141:3142:3653:3865:3866:3867:3868:3870:4117:4605:5007:6117:6261:7903:8957:9121:10004:11026:11233:11658:11914:12043:12048:12291:12296:12297:12438:12555:12683:12895:13146:13230:13894:14095:14096:14181:14394:14659:14721:21060:21080:21221:21222:21324:21325:21627:30029:30054,0,RBL:115.124.30.130:@linux.alibaba.com:.lbl8.mailshell.net-62.20.2.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: rice06_53ffddc471b27 X-Filterd-Recvd-Size: 6147 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Aug 2019 09:49:36 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R471e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0TZztT3d_1566294571; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TZztT3d_1566294571) by smtp.aliyun-inc.com(127.0.0.1); Tue, 20 Aug 2019 17:49:31 +0800 From: Alex Shi To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Mel Gorman , Tejun Heo Cc: Alex Shi Subject: [PATCH 00/14] per memcg lru_lock Date: Tue, 20 Aug 2019 17:48:23 +0800 Message-Id: <1566294517-86418-1-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patchset move lru_lock into lruvec, give a lru_lock for each of lruvec, thus bring a lru_lock for each of memcg. Per memcg lru_lock would ease the lru_lock contention a lot in this patch series. In some data center, containers are used widely to deploy different kind of services, then multiple memcgs share per node pgdat->lru_lock which cause heavy lock contentions when doing lru operation. On my 2 socket * 6 cores E5-2630 platform, 24 containers run aim9 simultaneously with mmtests' config: # AIM9 export AIM9_TESTTIME=180 export AIM9_TESTLIST=page_test,brk_test perf lock report show much contentions on lru_lock in 20 second snapshot: Name acquired contended avg wait (ns) total wait (ns) max wait (ns) min wait (ns) &(ptlock_ptr(pag... 22 0 0 0 0 0 ... &(&pgdat->lru_lo... 9 7 12728 89096 26656 1597 With this patch series, lruvec->lru_lock show no contentions &(&lruvec->lru_l... 8 0 0 0 0 0 and aim9 page_test/brk_test performance increased 5%~50%. BTW, Detailed results in aim9-pft.compare.log if needed, All containers data are increased and pretty steady. $for i in Max Min Hmean Stddev CoeffVar BHmean-50 BHmean-95 BHmean-99; do echo "========= $i page_test ============"; cat aim9-pft.compare.log | grep "^$i.*page_test" | awk 'BEGIN {a=b=0;} { a+=$3; b+=$6 } END { print "5.3-rc4 " a/24; print "5.3-rc4+lru_lock " b/24}' ; done ========= Max page_test ============ 5.3-rc4 34729.6 5.3-rc4+lru_lock 36128.3 ========= Min page_test ============ 5.3-rc4 33644.2 5.3-rc4+lru_lock 35349.7 ========= Hmean page_test ============ 5.3-rc4 34355.4 5.3-rc4+lru_lock 35810.9 ========= Stddev page_test ============ 5.3-rc4 319.757 5.3-rc4+lru_lock 223.324 ========= CoeffVar page_test ============ 5.3-rc4 0.93125 5.3-rc4+lru_lock 0.623333 ========= BHmean-50 page_test ============ 5.3-rc4 34579.2 5.3-rc4+lru_lock 35977.1 ========= BHmean-95 page_test ============ 5.3-rc4 34421.7 5.3-rc4+lru_lock 35853.6 ========= BHmean-99 page_test ============ 5.3-rc4 34421.7 5.3-rc4+lru_lock 35853.6 $for i in Max Min Hmean Stddev CoeffVar BHmean-50 BHmean-95 BHmean-99; do echo "========= $i brk_test ============"; cat aim9-pft.compare.log | grep "^$i.*brk_test" | awk 'BEGIN {a=b=0;} { a+=$3; b+=$6 } END { print "5.3-rc4 " a/24; print "5.3-rc4+lru_lock " b/24}' ; done ========= Max brk_test ============ 5.3-rc4 96647.7 5.3-rc4+lru_lock 98960.3 ========= Min brk_test ============ 5.3-rc4 91800.8 5.3-rc4+lru_lock 96817.6 ========= Hmean brk_test ============ 5.3-rc4 95470 5.3-rc4+lru_lock 97769.6 ========= Stddev brk_test ============ 5.3-rc4 1253.52 5.3-rc4+lru_lock 596.593 ========= CoeffVar brk_test ============ 5.3-rc4 1.31375 5.3-rc4+lru_lock 0.609583 ========= BHmean-50 brk_test ============ 5.3-rc4 96141.4 5.3-rc4+lru_lock 98194 ========= BHmean-95 brk_test ============ 5.3-rc4 95818.5 5.3-rc4+lru_lock 97857.2 ========= BHmean-99 brk_test ============ 5.3-rc4 95818.5 5.3-rc4+lru_lock 97857.2 Alex Shi (14): mm/lru: move pgdat lru_lock into lruvec lru/memcg: move the lruvec->pgdat sync out lru_lock lru/memcg: using per lruvec lock in un/lock_page_lru lru/compaction: use per lruvec lock in isolate_migratepages_block lru/huge_page: use per lruvec lock in __split_huge_page lru/mlock: using per lruvec lock in munlock lru/swap: using per lruvec lock in page_cache_release lru/swap: uer lruvec lock in activate_page lru/swap: uer per lruvec lock in pagevec_lru_move_fn lru/swap: use per lruvec lock in release_pages lru/vmscan: using per lruvec lock in lists shrinking. lru/vmscan: use pre lruvec lock in check_move_unevictable_pages lru/vmscan: using per lruvec lru_lock in get_scan_count mm/lru: fix the comments of lru_lock include/linux/memcontrol.h | 24 ++++++++++---- include/linux/mm_types.h | 2 +- include/linux/mmzone.h | 6 ++-- mm/compaction.c | 48 +++++++++++++++++----------- mm/filemap.c | 4 +-- mm/huge_memory.c | 9 ++++-- mm/memcontrol.c | 24 ++++++-------- mm/mlock.c | 35 ++++++++++---------- mm/mmzone.c | 1 + mm/page_alloc.c | 1 - mm/page_idle.c | 4 +-- mm/rmap.c | 2 +- mm/swap.c | 79 +++++++++++++++++++++++++--------------------- mm/vmscan.c | 63 ++++++++++++++++++------------------ 14 files changed, 166 insertions(+), 136 deletions(-)