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 7C7C9C77B7C for ; Wed, 24 May 2023 15:33:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A4BB90000C; Wed, 24 May 2023 11:33:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 155F3900007; Wed, 24 May 2023 11:33:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01DBE90000C; Wed, 24 May 2023 11:33: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 DFEDD900007 for ; Wed, 24 May 2023 11:33:13 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C267EAE110 for ; Wed, 24 May 2023 15:33:13 +0000 (UTC) X-FDA: 80825542266.22.DF59D2C Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf02.hostedemail.com (Postfix) with ESMTP id E5D8180025 for ; Wed, 24 May 2023 15:33:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=BI4rURRF; dkim=pass header.d=linutronix.de header.s=2020e header.b=AXHl8eTP; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf02.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684942390; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lYvue+5+U8g6PY27mjpGf7EoNllwg1l1SmANn8QWJuY=; b=2XjyX/9ONyXtt/XEqoM4Xgie2sd95PzTVm4hKgMe3PpGTNXAP6xEHWVXW56Oxgtow7aHg/ R4/7l+j7/ic9LG+l00pscbkFhF34ZFDVwcZI1ZDPp4to+1BPGbz7CK5c1qy2hPFlJBCvrv MaAxZTTOOSYqXP33moT8WU/piLkgjQE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=BI4rURRF; dkim=pass header.d=linutronix.de header.s=2020e header.b=AXHl8eTP; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf02.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684942390; a=rsa-sha256; cv=none; b=C9sxVw0JdEc6KsIbugW68ErUCccrac5emfqtBbNgSboE0/WZOrp2kqMyGWt19nddJHU8XA 0+E1Jo8FSKAbu6eFITD216BxzOdWf1+QIyVQgy9UhDpUeKv7ffhkbGMGhi51v6ByUcYVKs jKYWKKv0QDDG6FcnrCedMg8Nb9qJk5M= Date: Wed, 24 May 2023 17:33:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684942387; 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: in-reply-to:in-reply-to:references:references; bh=lYvue+5+U8g6PY27mjpGf7EoNllwg1l1SmANn8QWJuY=; b=BI4rURRFeibXSU3UNx24Gz/qJJrzJgVG1mtpRAVM5CQAXpmBkeuhSad9rCtSMgtpsudzRl Us9d7XylJ7xSEMoXOlkiV1uFWTUkTXfnoUQQd7SjKdobsrCZPY39+sP7ht+SQP7WB+fzAT cANyYXi4ziYYzDBRaFpgzNvVNTssh74/nAmoAW/N4jzm0spI0uHVPszwKwwrVTuRQs7dEx Fecpvu6OQHKsoSyRI/vC437j3IqgX+AP3FifyVm5AvES7v4OT2WfoK5UIa9QSsU74Mhjj2 sakogeIkwQ0lw8oXajCgkeQ3x3e+EHXMtC73+PvhxMRAELwCFH/EfNp+4aMN5A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684942387; 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: in-reply-to:in-reply-to:references:references; bh=lYvue+5+U8g6PY27mjpGf7EoNllwg1l1SmANn8QWJuY=; b=AXHl8eTPVVr3sXNv0cwNx5Q8u1j7CltAnQwZPkwr2CKwGTHCKMkbHjgS66wIs8hR6vmkII EspxYwax3VbEbEBQ== From: Sebastian Andrzej Siewior To: Matthew Wilcox Cc: Hillf Danton , linux-kernel@vger.kernel.org, "Eric W. Biederman" , Ingo Molnar , Mel Gorman , Oleg Nesterov , Peter Zijlstra , Thomas Gleixner , Vincent Guittot , linux-mm@kvack.org, Linus Torvalds Subject: Re: [PATCH v4] signal: Let tasks cache one sigqueue struct. Message-ID: <20230524153305.60aTQ2sC@linutronix.de> References: <20230406194004.KP1K6FwO@linutronix.de> <20230407000306.940-1-hdanton@sina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: E5D8180025 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 96mu4r9ueccfhpopsb8k8jjfofsg3ffz X-HE-Tag: 1684942389-192950 X-HE-Meta: U2FsdGVkX19zhbEec8RP7bTl0V7MS0kSiVjGEymLL1PAj2wJs8SEGIT/JQ/xsBRfbQzvCc6I4x4pTiMLrZra40gBQlgYwTwZvTYHr1bVPg/SleBVtQcb0cfrr+mETSDWKE3NyelpVzFuP/XoV1PpraHDxzhQTirxXeqep9b5JVanjKdwzuDvdf9EZj12cFj/eoKjxXvjoSQ+vOTPHb3krwrJdD8qTLNoF1WjicjuBxL0amqcUgbmE2ALja9LF98HM+Eu2jF1TfJOxni0I7c6fVUau8dBYFgreaCX6XaBxXzbVObBFdhp/VADfikcXdFsmY2c5dcwxIXQRGWmM1PUw8yhkIbIhw9I4JFuXXgWLq1NHShzELMvr5mP2HqHeN1j2CAmtZMb7o6znjZX5Vauj9DUG7aFiOmOBmEtIWKf7u1SKY+If+FQOUqWK3BMy89PSAqGymIZgUJg3TaCpZqLX0dw3lDb/aJT3mXs5eHLWvTTtavmEfBbO/v2T9/ytEc8jJZfPy4Z/ylqZPUHwzdg8BWBLnN2HGQb6l9dNgVSFf52npjFIsTOHm09SHAsZPhS/qNetz7cDWRy/HUL3EtfTdhjTvK0qHl0EGlO8NoBAR3ScYr5nnnyVqtyddrBJZ3Tc9jUHjxPgIA/lG+czi5QLNCO1LuesSIc+lNOM2w80dMXozkqzGRhtGbMFViAUhFxU9PyAmDQBZupJR7phMZHJ+KBIOlv8s0CuxFAEBL5ht2sh1NQvmbRNAJ3a/HQCucgwJVz8MM9OUVCTKck+cBeYYZ8l4idk8QZdFLOAa0CVod08xKFBXFd6a7fQHz6nZRpJQlW4VZ6y1H4R3UyTFp58Pobic+Osp2zYijacyz4Rr47uV8pEsue5RqCCdwgC/YsZWD+LeMG8bVfk24rMzIuM72YjhRV/JG1o9TutY4qzrB1wY9BFGA0sUfXK54XxRRsiCWOMjzTlPKN6GsJC2T AQ28lKOt 1l4CWZoP56og79nT2SIYlc27AcCRbyBBhKRiGOGW9usRVCx7qO/zx+0cBPlt2M59zm5rK6tOokDTEAkK1ulhcC1l5NfFXrfH6hfEi 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: On 2023-04-07 04:53:27 [+0100], Matthew Wilcox wrote: > On Fri, Apr 07, 2023 at 08:03:06AM +0800, Hillf Danton wrote: > > On Thu, 6 Apr 2023 22:47:21 +0200 Sebastian Andrzej Siewior > > > The sigqueue caching originated in the PREEMPT_RT tree. A few of the > > > applications, that were ported to Linux, were ported from OS-9. Sending > > > notifications from one task to another via a signal was a common > > > communication model there and so the applications are heavy signal > > > users. Removing the allocation reduces the critical path, avoids locks > > > and so lowers the maximal latency of the task while sending a signal. > > It might lower the _average_ latency, but it certainly doesn't lower > the _maximum_ latency, because you have to assume worst case scenario > for maximum latency. Which is that there's no sigqueue cached, so you > have to go into the slab allocator. And again, worst case scenario is > that you have to go into the page allocator from there, and further that > you have to run reclaim, and ... Yes. The idea is in general not to send more signals in parallel than the available number cached slots. > What I find odd about the numbers that you quote: > > > The numbers of system boot followed by an allmod kernel build: > > Out of 333216 allocations, 194876 (~58%) were served from the cache. > > From all free invocations, 4212 were in a path were caching is not done > > and 329002 sigqueue were cached. > > ... is that there's no absolute numbers. Does it save 1% of the cost > of sending a signal? 10%? What does perf say about the cost saved > by no longer going into slab? Because the fast path in slab is very > fast. It might even be quicker than your fast path for multithreaded > applications which have threads running on different NUMA nodes. I asked for updated numbers and the improvement is not as big as initially reported. There might have been a change in the configuration for the testing an so the improvement is not as big as initially assumed. I'm sorry, but I didn't get any numbers to back anything up. I'm dropping the effort here, thanks for the review :) Sebastian