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 154E3C4345F for ; Fri, 3 May 2024 14:30:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AFAC6B0088; Fri, 3 May 2024 10:30:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85FC06B0089; Fri, 3 May 2024 10:30:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 727876B008C; Fri, 3 May 2024 10:30:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 559B76B0088 for ; Fri, 3 May 2024 10:30:13 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0CF868117F for ; Fri, 3 May 2024 14:30:13 +0000 (UTC) X-FDA: 82077319506.06.0886773 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 2BBAE80022 for ; Fri, 3 May 2024 14:30:09 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J+CizU30; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714746610; 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=PQyDPEWquSneZazAM7l5FC7MEA777Fbe13YTst9r4EA=; b=LXcUJwsbQBR8EQ/soQmKtevsSHw6kFqVJS4I/ZSEh+TF27cpyNQKlxORLh3Y9MG/aMT3H7 wr/GcC+IKw8eVU1SgbWDdyFtuSVvwY7TW+TOjlavUdsoaJokszmmqRsFYTFwi80CLe+lvX qo8JZiyVOdBa0+GLaY0IAmNKRBqU1GM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714746610; a=rsa-sha256; cv=none; b=pLB8RjFwBVsFZPURtYFxJgtpTv3JDJuHOXXVHtzycmJLTZNeFCaLjYT76jpzmVdt0Qp4Zf Cnt0VEl33lP6BOxxL0hdrWS2E8itD3vVRerBB1eTgzNYkXBaXHLoZ0EeDnwn1SSuPP2NkI sBzkKVGCc8q2Vu9F+FKOKFMT6ig8jBQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J+CizU30; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714746609; h=from:from: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; bh=PQyDPEWquSneZazAM7l5FC7MEA777Fbe13YTst9r4EA=; b=J+CizU3030mXST5tx6b+HLetAJy1yCHpkTeikG/PwFkDX5NNzcOjL5gUsLzF+Iwm3VzwrE Bj1TlRUlUCAnVirw2ibisa5m0Lf0wMv47tYJat6Geb6x9XHNwzO8KnIIS5UYnmqnBIqy7+ 3AY4FOM7jJNaU7/J3xhcek+lNe7vI+Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-ICRn6dGgNDi-dtbBCnTnow-1; Fri, 03 May 2024 10:30:04 -0400 X-MC-Unique: ICRn6dGgNDi-dtbBCnTnow-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 283148A9146; Fri, 3 May 2024 14:30:03 +0000 (UTC) Received: from [10.22.34.156] (unknown [10.22.34.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F549C13FA4; Fri, 3 May 2024 14:30:02 +0000 (UTC) Message-ID: Date: Fri, 3 May 2024 10:30:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] cgroup/rstat: add cgroup_rstat_cpu_lock helpers and tracepoints To: Jesper Dangaard Brouer , tj@kernel.org, hannes@cmpxchg.org, lizefan.x@bytedance.com, cgroups@vger.kernel.org, yosryahmed@google.com Cc: netdev@vger.kernel.org, linux-mm@kvack.org, shakeel.butt@linux.dev, kernel-team@cloudflare.com, Arnaldo Carvalho de Melo , Sebastian Andrzej Siewior References: <171457225108.4159924.12821205549807669839.stgit@firesoul> <30d64e25-561a-41c6-ab95-f0820248e9b6@redhat.com> <4a680b80-b296-4466-895a-13239b982c85@kernel.org> <203fdb35-f4cf-4754-9709-3c024eecade9@redhat.com> <42a6d218-206b-4f87-a8fa-ef42d107fb23@kernel.org> Content-Language: en-US From: Waiman Long In-Reply-To: <42a6d218-206b-4f87-a8fa-ef42d107fb23@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2BBAE80022 X-Stat-Signature: 4zu1ob6spoezh5fcdoq6fiok548frenw X-Rspam-User: X-HE-Tag: 1714746609-147067 X-HE-Meta: U2FsdGVkX19AdM7++4zslmadHIVXO28vhBkzhM7tcR37ByNii34e2750N+xYoRvfXT9dcg9jABNgNeXdDdZSpXR0S73NjZQrn0UIqosjjUW9Zr3UYokVSSI9yzz5CQ75mtVyf1PfrVJ7T62r6ihWeMCyi0zKhWMY8ORyMIug5tpd3fxcacP52d+xpqqnPNhRL5XEwsRiXLXi6bGD9ppsoDzDYSiYz+kjpi/WvL1Okv7vVvj2WtpNG+ZWg05E6DggP4ESAZYupuneiip9C4xsArtjz+3pvz4ULvXdIMj5jtyZb62uWTE6IJguxya3jdq8sF2p5bCO8jo+Np2a1eq5Sasd75sQ0BXEbNtIsVpniIbRHgMrzHKjwjedHjGS5D2pHFY3MkCkHqhCZvRK6j8jlEG142mhJWtjeVm46/shEfr4zE6QQA4Y0B236pvuaa4LNJMNsgZ7x++6pq3bMr0N/IPvrhyuXX6IsvRR2in+P5gM4c4e7KbBkGOPQY9Tg5nC2bNqAANn8GsWy8jgI2jjOiXMKOq/P/XpkMBs5X4tErf05yx7/JOjTg9r/KDl2YKB+WuPy8oLtiaaj69Hv05AJ8NbCtvxdcJ5tXZDccEgTnqD5EsTFsISCYLdQaGeByFbcj37eEsl58xQzLfP4yVGO7BAuF8Erjh5p9lk8HbbMjiA9oj6JueFYOJFPKgV3VyrTlB2mqwMJFLz6JqeEAwi5rYCGzVKuCKDphUP962z2I2broDyp7mg2tntIaihKuLU6j1Anx5bD/mqHaoA6SbMIopvStTbbaQGghDyhQlXirWMiZ478k9V3HACDOD/0wm7NwfBufNWYHQFxYDIU1+rRwqAvrKBPCcbh5TawEOJAxZqU5n3pmO2FIlNvajOEhd7Q0yDgi1hddPtbRTthyllEJTkyHhzx4CS0kzuvu1KNFQqxkg6PSM3G9DY8AJjKeB7dipb5Yv3jYTjff7Rio3 vPMV1FNT vUmDvbNx4jnkjcRabSiTepOgC40cdxyAk+4PemPb9sJ3bZVHcDK9e4MsLsZFw29TxHU4chdrpK3R71wWmsJ9HceYJ0xxAqTHeByqaWTwbx91iZvsPLq7IF62WVucwlRgnPpYb5FW8/R4HRMIsc4GFVdeBqCTlTPdrJzZrITszIbOqISRjrtwktJPkxFJU0IR9uZLNNgzy0xtClgDT55ZhcGhvDAYmVDltaXQFEtB09cV5OtWAWCuCU0zcwQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.161942, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 5/3/24 10:00, Jesper Dangaard Brouer wrote: >> I may have mistakenly thinking the lock hold time refers to just the >> cpu_lock. Your reported times here are about the cgroup_rstat_lock. >> Right? If so, the numbers make sense to me. >> > > True, my reported number here are about the cgroup_rstat_lock. > Glad to hear, we are more aligned then 🙂 > > Given I just got some prod machines online with this patch > cgroup_rstat_cpu_lock tracepoints, I can give you some early results, > about hold-time for the cgroup_rstat_cpu_lock. > > From this oneliner bpftrace commands: > >   sudo bpftrace -e ' >          tracepoint:cgroup:cgroup_rstat_cpu_lock_contended { >            @start[tid]=nsecs; @cnt[probe]=count()} >          tracepoint:cgroup:cgroup_rstat_cpu_locked { >            $now=nsecs; >            if (args->contended) { >              @wait_per_cpu_ns=hist($now-@start[tid]); > delete(@start[tid]);} >            @cnt[probe]=count(); @locked[tid]=$now} >          tracepoint:cgroup:cgroup_rstat_cpu_unlock { >            $now=nsecs; >            @locked_per_cpu_ns=hist($now-@locked[tid]); > delete(@locked[tid]); >            @cnt[probe]=count()} >          interval:s:1 {time("%H:%M:%S "); print(@wait_per_cpu_ns); >            print(@locked_per_cpu_ns); print(@cnt); clear(@cnt);}' > > Results from one 1 sec period: > > 13:39:55 @wait_per_cpu_ns: > [512, 1K)              3 |      | > [1K, 2K)              12 |@      | > [2K, 4K)             390 > |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| > [4K, 8K)              70 |@@@@@@@@@      | > [8K, 16K)             24 |@@@      | > [16K, 32K)           183 |@@@@@@@@@@@@@@@@@@@@@@@@      | > [32K, 64K)            11 |@      | > > @locked_per_cpu_ns: > [256, 512)         75592 |@      | > [512, 1K)        2537357 > |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| > [1K, 2K)          528615 |@@@@@@@@@@      | > [2K, 4K)          168519 |@@@      | > [4K, 8K)          162039 |@@@      | > [8K, 16K)         100730 |@@      | > [16K, 32K)         42276 |      | > [32K, 64K)          1423 |      | > [64K, 128K)           89 |      | > >  @cnt[tracepoint:cgroup:cgroup_rstat_cpu_lock_contended]: 3 /sec >  @cnt[tracepoint:cgroup:cgroup_rstat_cpu_unlock]: 3200  /sec >  @cnt[tracepoint:cgroup:cgroup_rstat_cpu_locked]: 3200  /sec > > > So, we see "flush-code-path" per-CPU-holding @locked_per_cpu_ns isn't > exceeding 128 usec. > > My latency requirements, to avoid RX-queue overflow, with 1024 slots, > running at 25 Gbit/s, is 27.6 usec with small packets, and 500 usec > (0.5ms) with MTU size packets.  This is very close to my latency > requirements. Thanks for sharing the data. This is more aligned with what I would have expected. Still, a high up to 128 usec is still on the high side. I remembered during my latency testing when I worked on cpu_lock latency patch, it was in the 2 digit range. Perhaps there are other sources of noise or the update list is really long. Anyway, it may be a bit hard to reach the 27.6 usec target for small packets. Cheers, Longman