Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3772698pxk; Tue, 22 Sep 2020 02:02:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJKFiYN6iWwmEhozIlPcyREP3q3I2wfyWuXNLuoDGtEqif9KgpnOWqnwhtwZ+XY9s+IBkP X-Received: by 2002:aa7:cd5a:: with SMTP id v26mr2823758edw.38.1600765346444; Tue, 22 Sep 2020 02:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600765346; cv=none; d=google.com; s=arc-20160816; b=1ARZbc7FL6AsCvly3yYbnKz5Q5ISmjGp4b9JcN3vF5MXbLzwdOtoQBVQFp058Gwc0C pA0YV35OyPaBqX2oTTWbDeiUdlld9DmPQpSlYKMIYWUsVX/tc8hWkW4HP3/4V5+bVZYa n9N6Q+9OifLVdiH1/UhXDbgdNkNPNEr+hk/bmjwi8z7MafrLQj0nVfC4qVTTi00RfW/9 OmKTjqODrWSt3qVubIxoEAmr+hwQfeKQSy1xhg1c2Hkke30/wUKiMrxpIjufeWRvTYsd i7MPwkvf+OsJuJcioTwA4uzBQCmMqFzc2jYy9bSLy3Iyyi4EQykgAkq+ADMIxVi9pJj/ 2isQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=qunX5v2po5bopea6MY7NuKi99VNG2psdYwT9LXmuB94=; b=BhL1Jrant1Vv6vmDI8d/7XMtpEuDjMqd+2kR1OOnv1xecQlYRYC9F7r4eEHoz7t0QL D+Q6RjaZ2X/zTiWU/WXh2e4G6JhZ+obQ86i5KBTfqsMRKVR5oQzaop7K8xHFe3QYlRA7 R2c6arIH/0yu6CbALjBOendbUEq6f7outVir/pDjz0B7KUmjZ2PIyNlLxLxm7RC3Kxj4 Wpt5VQkvkd4wQwXbBZOXnY9fV3uHRA0jQWPwKlqVM+BI0ggJjyEygb9YVC4FXCGKjPx3 Agsxo3c+E3S64BTrLcxvOphD4Lufv6CdO9tzJOJeftU5pAC3a/UMSvGsKmLnRAPv90O8 yU2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si10265965edt.218.2020.09.22.02.02.02; Tue, 22 Sep 2020 02:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbgIVJBD (ORCPT + 99 others); Tue, 22 Sep 2020 05:01:03 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:40338 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbgIVJBD (ORCPT ); Tue, 22 Sep 2020 05:01:03 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=23;SR=0;TI=SMTPD_---0U9lgfBQ_1600765256; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U9lgfBQ_1600765256) by smtp.aliyun-inc.com(127.0.0.1); Tue, 22 Sep 2020 17:00:57 +0800 Subject: Re: [PATCH v18 20/32] mm/lru: replace pgdat lru_lock with lruvec lock To: Hugh Dickins Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com, Michal Hocko , Yang Shi References: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> <1598273705-69124-21-git-send-email-alex.shi@linux.alibaba.com> From: Alex Shi Message-ID: <0ae8709b-b82a-0956-9934-cbbd1f2e50ce@linux.alibaba.com> Date: Tue, 22 Sep 2020 16:58:47 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/9/22 ????1:27, Hugh Dickins ะด??: > On Mon, 24 Aug 2020, Alex Shi wrote: > >> This patch moves per node lru_lock into lruvec, thus bring a lru_lock for >> each of memcg per node. So on a large machine, each of memcg don't >> have to suffer from per node pgdat->lru_lock competition. They could go >> fast with their self lru_lock. >> >> After move memcg charge before lru inserting, page isolation could >> serialize page's memcg, then per memcg lruvec lock is stable and could >> replace per node lru lock. >> >> In func isolate_migratepages_block, compact_unlock_should_abort is >> opend, and lock_page_lruvec logical is embedded for tight process. > > Hard to understand: perhaps: > > In func isolate_migratepages_block, compact_unlock_should_abort and > lock_page_lruvec_irqsave are open coded to work with compact_control. will update with your suggestion. Thanks! > >> Also add a debug func in locking which may give some clues if there are >> sth out of hands. >> >> According to Daniel Jordan's suggestion, I run 208 'dd' with on 104 >> containers on a 2s * 26cores * HT box with a modefied case: >> https://git.kernel.org/pub/scm/linux/kernel/git/wfg/vm-scalability.git/tree/case-lru-file-readtwice > > s/modeified/modified/ > lruv19 has an lkml.org link there, please substitut > https://lore.kernel.org/lkml/01ed6e45-3853-dcba-61cb-b429a49a7572@linux.alibaba.com/ > Thanks! >> >> With this and later patches, the readtwice performance increases >> about 80% within concurrent containers. >> >> On a large machine with memcg enabled but not used, the page's lruvec >> seeking pass a few pointers, that may lead to lru_lock holding time >> increase and a bit regression. >> >> Hugh Dickins helped on patch polish, thanks! >> >> Reported-by: kernel test robot > > Eh? It may have reported some locking bugs somewhere, but this > is the main patch of your per-memcg lru_lock: I don't think the > kernel test robot inspired your whole design, did it? Delete that. > > >> Signed-off-by: Alex Shi > > I can't quite Ack this one yet, because there are several functions > (mainly __munlock_pagevec and check_move_unevictable_pages) which are > not right in this v18 version, and a bit tricky to correct: I already > suggested what to do in other mail, but this patch comes before > relock_page_lruvec, so must look different from the final result; > I need to look at a later version, perhaps already there in your > github tree, before I can Ack: but it's not far off. > Comments below. All suggestions are taken! Many thanks for so detailed review! A new branch with all comments is updated as https://github.com/alexshi/linux.git lruv19.5 A quick summary for the branch, Add a new patch for move_pages_to_lru: mm/vmscan: remove lruvec reget in move_pages_to_lru Add another patch for split part from 'Introduce TestClearPageLRU': mm/swap.c: reorder __ClearPageLRU and lruvec the mlock changes moved earlier: mm/mlock: remove __munlock_isolate_lru_page mm/mlock: remove __munlock_isolate_lru_page I am wondering if it's good to send out v19 here or maybe better to wait for your confirm if all suggestion/comments are settled? Thanks Alex