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 X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4A32C433ED for ; Thu, 8 Apr 2021 16:23:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48D47610CF for ; Thu, 8 Apr 2021 16:23:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48D47610CF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D10FB6B0083; Thu, 8 Apr 2021 12:23:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC1436B0085; Thu, 8 Apr 2021 12:23:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B613D6B0087; Thu, 8 Apr 2021 12:23:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id 970806B0083 for ; Thu, 8 Apr 2021 12:23:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5B9F198A5 for ; Thu, 8 Apr 2021 16:23:01 +0000 (UTC) X-FDA: 78009718962.15.7EBBC22 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf25.hostedemail.com (Postfix) with ESMTP id 41A006000109 for ; Thu, 8 Apr 2021 16:22:59 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id s17so2987027ljc.5 for ; Thu, 08 Apr 2021 09:23:00 -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=I4keGOu+fd1R3DyTJ+lPEeGCkI+bHMb+zuPsWV4Jf/a1tAn2ZubynVuHkQTFegx8Hc KhC1A2AWeF7KcC8YVlVbJfAUCUnbzAtDXdC5GCxHga0zDft+WcVgDRkaWcdZh8ybgFXf WSAZADIoporRl3Ukhc1Yza3Lv0Jn9LpumDunBfehVdv9mkbRe2PsisbWI4CqNLxCWmZE t3VlOjoTB2AMvUOZLIi/6X7ZUJxmMFWftHrx9oFTOyLmGMORCdPchhrQGGtTaDrhKNOr 3rJPY9XIXlwvHCA+tW9kt4fQR49OdMPMSSI2jSZMEUsYgoX2Q5CZBuN2B6RIG20d8jXR 2V0w== X-Gm-Message-State: AOAM532ghnNREWVVQAmzB6h5D2neG1+4juvKQ9mUQIc2eZE4VNPWbfgR nXZ1ETV7OBEOIvsKTMhvYk2ryRox+q1eCw== X-Google-Smtp-Source: ABdhPJxTnG3LpUUwoFJpqP9fLdatyNU5tUmHfhMHisAV0O94hTGUOGa6kL/FahKRUb4e67ycPOKV3g== X-Received: by 2002:a2e:b80a:: with SMTP id u10mr6372924ljo.475.1617898978920; Thu, 08 Apr 2021 09:22:58 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id t193sm782912lff.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-f171.google.com with SMTP id y1so2971281ljm.10 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 41A006000109 X-Stat-Signature: 8sfhrgb1jfbh8rusdoifb38jjgaj837e Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=mail-lj1-f180.google.com; client-ip=209.85.208.180 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617898979-241212 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 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