Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp610940pxf; Thu, 8 Apr 2021 09:24:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL7boJ0DdiKSyjzR+Qrav/arLNUtx1vDdnM74Wdo0HhVzsFGrwQcUqitzGYU1eTZfkHgrT X-Received: by 2002:a63:74c:: with SMTP id 73mr8623767pgh.200.1617899080656; Thu, 08 Apr 2021 09:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617899080; cv=none; d=google.com; s=arc-20160816; b=PCCcBgl1Ey6PPUUDxjn84ZbwNnOjkn6+qpoUbE2TxNUme7ZfsXz0plib2h0DuyXr0l 9Aiv+iJO/FzxSN0duiK4khf3fKuaSnWTurBzUTVQ3bHjMeBdc+GaJNJoyyCLdPHiYEAa LogMLHcarkyTgrzQF6ii+eLkgTNMEk/tajdsSAKc9ZesgLwpQjI0EhOK04JDUnBL0YiV gdS3sG0YsFEFUxPaGhWXMmJJLmI1aLnyNfIyuZ5bTlhpxb+42FUoghKRuj9wyv7srQqq X6cXKr8J6922DfBUhg08HyNJ/Pq8euaIcwM7RbALJVm+eWy72b1GVKFt4806tFenvRX9 A1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6G3+OZqQp9tJwJbpfeOs5bop8D+dStV4QMNjNUA2tCA=; b=JoMG8A71qu2Qb92SrseUHQdoOtZ8g/QoB2iLy5BG+qxE1Sc7OHLCstjFRq8a+SMBFf rihLhSA3p5f4kdCT9FjPIYK07HDoo1F5+LkH5cQ3yqjR5JYTmueBiDmWoh9GDuKJiUrB LbWbimR7YiaSL2GAjleMHTFzCKZIFYjVrTTpzMh5K54+Bsdlu1+kLjVf+o5O8Z6FID5G Oq3Gu8Q3OihEb81ncJ2B0mXncRO/mWMin9Aj1P4dP7dt/Q5D+hSsdcNiSSvy9CaqUdDu sEHC0YVuDifI6yQcInsPPjz2hl2seuMu8cLvPXTVA6OdThpcfF/IrCELdW/+iMdqO70t weHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TtHskSvL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si20592583pgn.483.2021.04.08.09.24.27; Thu, 08 Apr 2021 09:24:40 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=TtHskSvL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbhDHQXO (ORCPT + 99 others); Thu, 8 Apr 2021 12:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231875AbhDHQXL (ORCPT ); Thu, 8 Apr 2021 12:23:11 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CE2C061760 for ; Thu, 8 Apr 2021 09:22:59 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 184so2979330ljf.9 for ; Thu, 08 Apr 2021 09:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6G3+OZqQp9tJwJbpfeOs5bop8D+dStV4QMNjNUA2tCA=; b=TtHskSvLyj69vK1NCJTAi43mfhUPjOkxPD6JbyziSbl7SJzch4R+8xG013pZQnNkeo MCi+JyVnrfhl3zL7fyFATmJrEoh6L3MqxEHNYC3Ir+EOyZhzDUDXGuKQ5QhVSoNnyyH1 PoXSkpV6XJTxGofaxbR4HFXQygQ82aFV+tUZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6G3+OZqQp9tJwJbpfeOs5bop8D+dStV4QMNjNUA2tCA=; b=R3ekr1ZwiPSMclLTqI1dEcxmkSJgKUbj5KI8HwtEfMqh2m5CePeCtqwIvYZBf2cwnN svdeq5Qf0Rz8vdHF3/XWW0xf1vk+p8C7Fi6SjVd9JV/BJiTBxKU1yrngzrD21jLBqtua 6Ukat43mpz/mZQtM7ZciCC0SUjfFSjpihzh6nVSpJKl2aBi47ApKXFescb1P6WIvu2Aa OjgsF3H8OJCTK5WOnnVt1rlbxlSUxt+RbawgG9zJFLOwacuj/fqcXWbjMyk2toyABSHl A+dbTq8yZKySK42lzAAvulgctQlq9PhSNpDLulaxv7WGbUz9r2mJEAvNcfvqiV62ZL1y AHcA== X-Gm-Message-State: AOAM532t2jLfEYPxhPbRCTTZsMs3wh+LyD81kxPqZawFeTJXQdG/q7py fyN7HfUd/HUPZn3p3YMmZy9e+IMXigU+Ew== X-Received: by 2002:a2e:9a4e:: with SMTP id k14mr6402847ljj.116.1617898978046; Thu, 08 Apr 2021 09:22:58 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id t193sm782911lff.2.2021.04.08.09.22.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 09:22:57 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id s17so2986919ljc.5 for ; Thu, 08 Apr 2021 09:22:57 -0700 (PDT) X-Received: by 2002:a2e:a306:: with SMTP id l6mr4543789lje.251.1617898977209; Thu, 08 Apr 2021 09:22:57 -0700 (PDT) MIME-Version: 1.0 References: <7abe5ab608c61fc2363ba458bea21cf9a4a64588.1617814298.git.gladkov.alexey@gmail.com> <20210408083026.GE1696@xsang-OptiPlex-9020> In-Reply-To: <20210408083026.GE1696@xsang-OptiPlex-9020> From: Linus Torvalds Date: Thu, 8 Apr 2021 09:22:40 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: 08ed4efad6: stress-ng.sigsegv.ops_per_sec -41.9% regression To: kernel test robot Cc: Alexey Gladkov , 0day robot , LKML , lkp@lists.01.org, "Huang, Ying" , Feng Tang , zhengjun.xing@intel.com, Kernel Hardening , Linux Containers , Linux-MM , Alexey Gladkov , Andrew Morton , Christian Brauner , "Eric W . Biederman" , Jann Horn , Jens Axboe , Kees Cook , Oleg Nesterov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 8, 2021 at 1:32 AM kernel test robot wr= ote: > > FYI, we noticed a -41.9% regression of stress-ng.sigsegv.ops_per_sec due = to commit > 08ed4efad684 ("[PATCH v10 6/9] Reimplement RLIMIT_SIGPENDING on top of uc= ounts") Ouch. I *think* this test may be testing "send so many signals that it triggers the signal queue overflow case". And I *think* that the performance degradation may be due to lots of unnecessary allocations, because ity looks like that commit changes __sigqueue_alloc() to do struct sigqueue *q =3D kmem_cache_alloc(sigqueue_cachep, flags); *before* checking the signal limit, and then if the signal limit was exceeded, it will just be free'd instead. The old code would check the signal count against RLIMIT_SIGPENDING *first*, and if there were m ore pending signals then it wouldn't do anything at all (including not incrementing that expensive atomic count). Also, the old code was very careful to only do the "get_user()" for the *first* signal it added to the queue, and do the "put_user()" for when removing the last signal. Exactly because those atomics are very expensive. The new code just does a lot of these atomics unconditionally. I dunno. The profile data in there is a bit hard to read, but there's a lot more cachee misses, and a *lot* of node crossers: > 5961544 +190.4% 17314361 perf-stat.i.cache-misses > 22107466 +119.2% 48457656 perf-stat.i.cache-reference= s > 163292 =C4=85 3% +4582.0% 7645410 perf-stat.i.node-load-= misses > 227388 =C4=85 2% +3708.8% 8660824 perf-stat.i.node-loads and (probably as a result) average instruction costs have gone up enormousl= y: > 3.47 +66.8% 5.79 perf-stat.overall.cpi > 22849 -65.6% 7866 perf-stat.overall.cycles-be= tween-cache-misses and it does seem to be at least partly about "put_ucounts()": > 0.00 +4.5 4.46 perf-profile.calltrace.cycl= es-pp.put_ucounts.__sigqueue_free.get_signal.arch_do_signal_or_restart.exit= _to_user_mode_prepare and a lot of "get_ucounts()". But it may also be that the new "get sigpending" is just *so* much more expensive than it used to be. Linus