From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A76CC64EC4 for ; Wed, 8 Mar 2023 11:59:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BA126B0072; Wed, 8 Mar 2023 06:59:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 769756B0074; Wed, 8 Mar 2023 06:59:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 609B9280001; Wed, 8 Mar 2023 06:59:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4EADB6B0072 for ; Wed, 8 Mar 2023 06:59:38 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0B07FAAB84 for ; Wed, 8 Mar 2023 11:59:38 +0000 (UTC) X-FDA: 80545586436.05.9C1017A Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf13.hostedemail.com (Postfix) with ESMTP id 32AD820009 for ; Wed, 8 Mar 2023 11:59:34 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=EFma8Wgu; spf=pass (imf13.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678276776; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iVQjKCHWrN1eYBET3mp20Di+hZdbe0lSR42xPROArtQ=; b=nm3aSQUZw+L4pflwbL8upaXa5lf/9ULybIapvreTJiNoqhdBEpOQXp7gpFtpvVpk5H9GII tONRMeY/FMVq742C3JECN5Ypi5HRZKixzWVRQpYoZoyzWnpucE3RArdHaILQn5OXhpZ78t lcIr+rVRjvqB3I+VxBP9BpcZV93F4bo= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=EFma8Wgu; spf=pass (imf13.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678276776; a=rsa-sha256; cv=none; b=VmqLTq960DeGYfDrVn9/6f1w92JxPGzmyxbyxL6LPCMmGdVYJlGhw12D/O1Qmj0RVctU0U Yblqa/QXXKhsK4m9/nyz+L0Iwonrqv1iCjVIGN8GWdLejWjGjNv5Z3+D/sw+Wr1aIrJLzr e/6xYaam+tXpJJGTyI5ynGJc2sK/9XM= Received: by mail-pj1-f42.google.com with SMTP id x34so16334285pjj.0 for ; Wed, 08 Mar 2023 03:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1678276773; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iVQjKCHWrN1eYBET3mp20Di+hZdbe0lSR42xPROArtQ=; b=EFma8WgumnWMBW5sY+8kyuxHAzk5tNDb3Us6ZXeEaqwsYNheJwUgm86SBytCi8fOCB EuFC4LS+zO10RkMWEYMdQH7BqGybOto2clmwFOSkZk5XQpM3YadMZw1PI6DTYbRxT7wh VI3Za0HSA3GwO+3Y3Nn65mp2EBuGrBWFSbxR0i9w+VbiLNNqJrhvfvEqfDolMJ7jcFn2 Bs3S2R8lFyZrT3OaRVOLcORIWC4W4J9NCfUL1izwSxRl4cE1pTC46ZLpSvNb4tmPUIq7 nMZxLsL+foPBi967TsVrF2kJBnVi8V9RMdM/aLuWwTO69guWPqnEUlc6kGwUZ6sziicL CNeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678276773; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iVQjKCHWrN1eYBET3mp20Di+hZdbe0lSR42xPROArtQ=; b=gnOeXqatUu1ETtNQi43jnzM6STlQ5QD66WNkV+BcSHypiJYLWxsvdAKgPGbUTqS8L9 50Lj7W8klZ5kGep+qK1Ov0bi3p2jxOamxgDigN1Wrvvexwj79npdVDMfytpK+bmOhLbX jFQqFpeO2BicurQmsZIZWTJLumu3te7sCZ+fAQq1bAcXbAmhxjK9Bpyj8ekCjbH+AmoY k0aPb61k6YGdB4vapOucNI4BhBO/BfXPMktczEjwT+jqjDrRE9AZDBTP++xp69gJdQtD mRLZisuq24gzaHRtA/BhuIxvyRV8x5wTSXkK1dktAOVZfe0TKGOw1P64lBiMV5O9EJX8 08SA== X-Gm-Message-State: AO0yUKUShvUMwtNJ02KY/98aw4dgyyf3ZLgFP4y2qsBVJ7gOqAkyfk13 NYgGsQqc6StRFg2RywqykP+K1A== X-Google-Smtp-Source: AK7set/B2Iric4xq4dnnxMX1BGr/ZiRInaW9P9lKh/kW7S7m31/ABfaXCj0SKF+7cclRwHMN6tjwbA== X-Received: by 2002:a05:6a20:3caa:b0:cc:ce6f:849d with SMTP id b42-20020a056a203caa00b000ccce6f849dmr19896528pzj.2.1678276773530; Wed, 08 Mar 2023 03:59:33 -0800 (PST) Received: from [10.70.252.135] ([139.177.225.229]) by smtp.gmail.com with ESMTPSA id 196-20020a6306cd000000b0050336b0b08csm9135022pgg.19.2023.03.08.03.59.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Mar 2023 03:59:32 -0800 (PST) Message-ID: <6e926e0c-e971-7f0c-70f0-e224abb6740e@bytedance.com> Date: Wed, 8 Mar 2023 19:59:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v4 0/8] make slab shrink lockless To: Andrew Morton Cc: tkhai@ya.ru, hannes@cmpxchg.org, shakeelb@google.com, mhocko@kernel.org, roman.gushchin@linux.dev, muchun.song@linux.dev, david@redhat.com, shy828301@gmail.com, rppt@kernel.org, sultan@kerneltoast.com, dave@stgolabs.net, penguin-kernel@I-love.SAKURA.ne.jp, paulmck@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230307065605.58209-1-zhengqi.arch@bytedance.com> <20230307142026.31c964475fd3c9554a4f62cb@linux-foundation.org> Content-Language: en-US From: Qi Zheng In-Reply-To: <20230307142026.31c964475fd3c9554a4f62cb@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: rmgjdsi4mtancguzx83aop9rwkcyodt3 X-Rspam-User: X-Rspamd-Queue-Id: 32AD820009 X-Rspamd-Server: rspam06 X-HE-Tag: 1678276774-431512 X-HE-Meta: U2FsdGVkX1/zelLqhEKa6k3hj6qtE8RLreZTf5zgXJ2DiC9nCW4lMyM84sYDdExbOETpoi/yiQLD8WRuCRrwmFfO4Wlj7o98d4gW286+ndI4quZsQiVxZ9v4wVM9mYdW/l/++kZlBtZtHVaH9rjeAaij6sHyFXeqOrmYQ/CKqAKyY3cb/NKhaUKJ42BwSWDg7KKx1BJxvrnbfO7HZ5F8VV8XpEuGrcz3sMHaSLqW+JwRDvXdm0Lt0uRJ2crvd/tXS0QhGv+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BZKIwAzxAFWmA1il2CHWs1wko6kqld7TYEWle6EDCXhl2q/9faTGjhEkYJUdhzPQVp/OLUqmAz5y1yTZRvibNz9XpGQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000093, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Andrew, On 2023/3/8 06:20, Andrew Morton wrote: > On Tue, 7 Mar 2023 14:55:57 +0800 Qi Zheng wrote: > >> Hi all, >> >> This patch series aims to make slab shrink lockless. > > The v3 discussion did contain requests for some sort of measurements of > real-world workloads. And Kirill did suggest a workload which could be > used for this measurement. > > It's quite important that we have this info, please. I mean, speeding > up real-world workloads is the entire point of the patchset and without > measurements, we don't know if the patchset achieves its primary > objective! I agree with this. For the down_read_trylock() hotspot problem I encountered, I posted a reproduction program in the cover letter, and measured the change of IPC before and after applying the patchset. For the case mentioned by Kirill, theoretically there is no competition between slab shrink and register_shrinker() after applying this patchset. But I haven't found a way to reproduce it yet, I will continue to try to do it. > > >> 3. Reproduction and testing >> =========================== >> >> We can reproduce the down_read_trylock() hotspot through the following script: >> >> ``` >> #!/bin/bash >> >> DIR="/root/shrinker/memcg/mnt" >> >> do_create() >> { >> mkdir -p /sys/fs/cgroup/memory/test >> mkdir -p /sys/fs/cgroup/perf_event/test >> echo 4G > /sys/fs/cgroup/memory/test/memory.limit_in_bytes >> for i in `seq 0 $1`; >> do >> mkdir -p /sys/fs/cgroup/memory/test/$i; >> echo $$ > /sys/fs/cgroup/memory/test/$i/cgroup.procs; >> echo $$ > /sys/fs/cgroup/perf_event/test/cgroup.procs; >> mkdir -p $DIR/$i; >> done >> } >> >> do_mount() >> { >> for i in `seq $1 $2`; >> do >> mount -t tmpfs $i $DIR/$i; >> done >> } >> >> do_touch() >> { >> for i in `seq $1 $2`; >> do >> echo $$ > /sys/fs/cgroup/memory/test/$i/cgroup.procs; >> echo $$ > /sys/fs/cgroup/perf_event/test/cgroup.procs; >> dd if=/dev/zero of=$DIR/$i/file$i bs=1M count=1 & >> done >> } >> >> case "$1" in >> touch) >> do_touch $2 $3 >> ;; >> test) >> do_create 4000 >> do_mount 0 4000 >> do_touch 0 3000 >> ;; >> *) >> exit 1 >> ;; >> esac >> ``` >> >> Save the above script, then run test and touch commands. Then we can use the >> following perf command to view hotspots: > > Well. Simply runnimg > > time that-script I tried this, but the script process will be killed because of OOM, so the measured time is not accurate. I will continue to try to measure more data besides IPC. Thanks, Qi > > before and after and including the info in the changelog would be a start?