Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp151451pxa; Wed, 26 Aug 2020 07:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwDzeupHGIein7u1hC8bnX/IpW+U6Kil3q2HrwI2GjdSY3w9xPQvja9SeM4tmoYjCbYir2 X-Received: by 2002:a17:906:60d5:: with SMTP id f21mr15634283ejk.94.1598451146143; Wed, 26 Aug 2020 07:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598451146; cv=none; d=google.com; s=arc-20160816; b=dCcLc+JXmK9ojo21Is40WnQdaw/wnb7zORWOpnF6oYTWhLazwKKDQzUFXS1rdSp/m3 8ZWEwPcPov6UjhB2xn94qSvHDenvkQd3/VZxOPyR0jIxsKoKmNm+iWdGon1OueQ4aYla F48Tx5kiSBa/oyA4tGGJrOlHcYewlmFxjCMSFv2b8A/Ve/OCdmP6iS9ZeLz/CDsJAuAJ Bz5iESq/ff2SFeRxdvp8FtflcXv05MnPhbN+DjPeg46FY6sKCRFFd678Cz5SV3ANs+hr bYUPSNfFDtyscwAc/YcCL+SXC0UO7q+3106Pv3G3ry77Ua1aG6zMHGDJQJUriNRoiUyO oOfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=dUwTW54xsNWozriwDq7zBug/cQwMeHQ6eQ+3lh9St7U=; b=B5caeaLbrtw2LUSbNd7si4XTjKrGXZPC7otz9rHQ6rI8EFBjuDa2b1WTPQa/t5Adj9 6JNzEXxllRHFsv/o8ZQGcAVcp5gQEl2zvSXwbHlTIiPtZUMWVR78DSLoGLNQ7hc3/j0S woGE1K+JlJO0hnrE9FG/7btUWOyt7INhhGcHltLFPgbOMVLJ8QQu4/Pg7BqJyQsEjcBE ih/zSXl0etH02ByzDqmpRb/41eNRdidng2uGKEyusuSIUFgdU9qZo/diH2lXDrx5AuUj IW/Vp+eu4rM8T431wuX5YvU1+MnAcRcMHBGzH1fhQZPzwp4BAwwAfCjYVFOGhektCTAx L7pg== 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 b23si1605272ejb.465.2020.08.26.07.12.02; Wed, 26 Aug 2020 07:12: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 S1727935AbgHZJBM (ORCPT + 99 others); Wed, 26 Aug 2020 05:01:12 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:52743 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727798AbgHZJBJ (ORCPT ); Wed, 26 Aug 2020 05:01:09 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R921e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U6uVqlE_1598432457; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U6uVqlE_1598432457) by smtp.aliyun-inc.com(127.0.0.1); Wed, 26 Aug 2020 17:01:02 +0800 Subject: Re: [PATCH v18 00/32] per memcg lru_lock To: Daniel Jordan Cc: Hugh Dickins , Andrew Morton , mgorman@techsingularity.net, tj@kernel.org, khlebnikov@yandex-team.ru, 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 References: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> <20200824114204.cc796ca182db95809dd70a47@linux-foundation.org> <20200825015627.3c3pnwauqznnp3gc@ca-dmjordan1.us.oracle.com> <20200826011946.spknwjt44d2szrdo@ca-dmjordan1.us.oracle.com> From: Alex Shi Message-ID: <01ed6e45-3853-dcba-61cb-b429a49a7572@linux.alibaba.com> Date: Wed, 26 Aug 2020 16:59:28 +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: <20200826011946.spknwjt44d2szrdo@ca-dmjordan1.us.oracle.com> Content-Type: multipart/mixed; boundary="------------7C4509CD50BDF422F0129A10" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------7C4509CD50BDF422F0129A10 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 在 2020/8/26 上午9:19, Daniel Jordan 写道: > On Tue, Aug 25, 2020 at 11:26:58AM +0800, Alex Shi wrote: >> 在 2020/8/25 上午9:56, Daniel Jordan 写道: >>> Alex, do you have a pointer to the modified readtwice case? >> >> Sorry, no. my developer machine crashed, so I lost case my container and modified >> case. I am struggling to get my container back from a account problematic repository. >> >> But some testing scripts is here, generally, the original readtwice case will >> run each of threads on each of cpus. The new case will run one container on each cpus, >> and just run one readtwice thead in each of containers. > > Ok, what you've sent so far gives me an idea of what you did. My readtwice > changes were similar, except I used the cgroup interface directly instead of > docker and shared a filesystem between all the cgroups whereas it looks like > you had one per memcg. 30 second runs on 5.9-rc2 and v18 gave 11% more data > read with v18. This was using 16 cgroups (32 dd tasks) on a 40 CPU, 2 socket > machine. I clean up my testing and make it reproducable by a Dockerfile and a case patch which attached. User can build a container from the file, and then do testing like following: #start some testing containers for ((i=0; i< 80; i++)); do docker run --privileged=true --rm lrulock bash -c " sleep 20000" & done #do testing evn setup for i in `docker ps | sed '1 d' | awk '{print $1 }'` ;do docker exec --privileged=true -it $i bash -c "cd vm-scalability/; bash -x ./case-lru-file-readtwice m"& done #kick testing for i in `docker ps | sed '1 d' | awk '{print $1 }'` ;do docker exec --privileged=true -it $i bash -c "cd vm-scalability/; bash -x ./case-lru-file-readtwice r"& done #show result for i in `docker ps | sed '1 d' | awk '{print $1 }'` ;do echo === $i ===; docker exec $i bash -c 'cat /tmp/vm-scalability-tmp/dd-output-* ' & done | grep MB | awk 'BEGIN {a=0;} { a+=$10 } END {print NR, a/(NR)}' This time, on a 2P * 20 core * 2 HT machine, This readtwice performance is 252% compare to v5.9-rc2 kernel. A good surprise! > >>> Even better would be a description of the problem you're having in production >>> with lru_lock. We might be able to create at least a simulation of it to show >>> what the expected improvement of your real workload is. >> >> we are using thousands memcgs in a machine, but as a simulation, I guess above case >> could be helpful to show the problem. > > Using thousands of memcgs to do what? Any particulars about the type of > workload? Surely it's more complicated than page cache reads :) Yes, the workload are quit different on different business, some use cpu a lot, some use memory a lot, and some are may mixed. For containers number, that are also quit various from tens to hundreds to thousands. > >>> I ran a few benchmarks on v17 last week (sysbench oltp readonly, kerndevel from >>> mmtests, a memcg-ized version of the readtwice case I cooked up) and then today >>> discovered there's a chance I wasn't running the right kernels, so I'm redoing >>> them on v18. > > Neither kernel compile nor git checkout in the root cgroup changed much, just > 0.31% slower on elapsed time for the compile, so no significant regressions > there. Now for sysbench again. > Thanks a lot for testing report! Alex --------------7C4509CD50BDF422F0129A10 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="Dockerfile" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Dockerfile" RlJPTSBjZW50b3M6OApNQUlOVEFJTkVSIEFsZXhzIAojV09SS0RJUiAvdm0tc2NhbGFiaWxp dHkgCiNSVU4geXVtIHVwZGF0ZSAteSAmJiB5dW0gZ3JvdXBpbnN0YWxsICJEZXZlbG9wbWVu dCBUb29scyIgLXkgJiYgeXVtIGNsZWFuIGFsbCAmJiBcCiNleGFtcGxlcyBodHRwczovL3d3 dy5saW51eHRlY2hpLmNvbS9idWlsZC1kb2NrZXItY29udGFpbmVyLWltYWdlcy13aXRoLWRv Y2tlcmZpbGUvClJVTiB5dW0gaW5zdGFsbCBnaXQgeGZzcHJvZ3MgcGF0Y2ggbWFrZSBnY2Mg LXkgJiYgeXVtIGNsZWFuIGFsbCAmJiBcCmdpdCBjbG9uZSAgaHR0cHM6Ly9naXQua2VybmVs Lm9yZy9wdWIvc2NtL2xpbnV4L2tlcm5lbC9naXQvd2ZnL3ZtLXNjYWxhYmlsaXR5LmdpdC8g JiYgXApjZCB2bS1zY2FsYWJpbGl0eSAmJiBtYWtlIHVzZW1lbQoKQ09QWSByZWFkdHdpY2Uu cGF0Y2ggL3ZtLXNjYWxhYmlsaXR5LwoKUlVOIGNkIHZtLXNjYWxhYmlsaXR5ICYmIHBhdGNo IC1wMSA8IHJlYWR0d2ljZS5wYXRjaAo= --------------7C4509CD50BDF422F0129A10 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="readtwice.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="readtwice.patch" ZGlmZiAtLWdpdCBhL2Nhc2UtbHJ1LWZpbGUtcmVhZHR3aWNlIGIvY2FzZS1scnUtZmlsZS1y ZWFkdHdpY2UKaW5kZXggODU1MzNiMjQ4NjM0Li41N2NiOTdkMTIxYWUgMTAwNzU1Ci0tLSBh L2Nhc2UtbHJ1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