Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11654237rwl; Tue, 3 Jan 2023 02:43:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXtLC9jxcIGlfMBcWEYdWmgfSqesTDZH7LDKC/3jGZEIka+CNhWw5CPRxZTBV0WXYTr6dZ9t X-Received: by 2002:a17:907:8e87:b0:84c:a863:ebe6 with SMTP id tx7-20020a1709078e8700b0084ca863ebe6mr12498616ejc.43.1672742585491; Tue, 03 Jan 2023 02:43:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672742585; cv=none; d=google.com; s=arc-20160816; b=CwEwST7QPKlZBW9sLWsfpIgZ0RZQfQ/8+4HtrWZyK2DddpyLZ5ViquNgM6waVNTcGa oLbji0c3rQKpna3bgw9gZaJAcbHIvuDX8UuwBsGie05pxAYGK2VjDbNPI/hRJGmD4FLJ 7y8upU/kj2+Xd/KInjHRRdeUkK3vMkRKK1SSr6TScbMnpD7Mezkiz70v4v2UYt92Lc5N TMHxW/xl3UlrvMumEIuWP9CXrL6VImWVIeHpA+xR0BiVJgCCt1iPr6Lq5KBRIWwLtNhI DXo94BtwN2d8e+EzxatZLcWeKoCBLcWszNjIn8SBSLG6cQT1pNqhelgiIAKZWCyrzsak UITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4coSDhKU7mwRMnUBHyZf53rh/zHTShyJKZjrQJqxxZQ=; b=aTj3WDxW4569Y76HnkcFtPkRRbt7kiA5ofcUVUTi0jVvwdhlbgH8Xf9+H3RcsQZwG0 fAp9XIo7VMp/9Q3Hsw3ou6p4wOkNM5psoPpEQsy/CbnxheL0/OhmCj8/TeRopn0exeJH FsmL+ccZAcUc7OHJ4xSqp5yfIpI1nFu66gkJ6S9NO0Ufbh75tWazYskcgoAZlYCvOQNx OtBjfKBKrc7JvD0CMwrRZCUann2XFrB2s1OzaNiUdihzXtvhwfIc5KkRSnTWMe/mrFuZ s7y2IH0QM/pSrEz7PYYTGNhJ2m/YnLNaGxpRSEC8Tc1WKCRRXBsGOgppMRaYy71TZiOg 7dqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=B12V0Jes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020a50ed16000000b0048463ca2e6fsi19785596eds.319.2023.01.03.02.42.50; Tue, 03 Jan 2023 02:43:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=B12V0Jes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236990AbjACKHE (ORCPT + 61 others); Tue, 3 Jan 2023 05:07:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236812AbjACKGt (ORCPT ); Tue, 3 Jan 2023 05:06:49 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3096B12A for ; Tue, 3 Jan 2023 02:06:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4coSDhKU7mwRMnUBHyZf53rh/zHTShyJKZjrQJqxxZQ=; b=B12V0JeslL/XIkP4Z0lltsBBWc tZfAKB3JMY2U5lPpdVnMCkPvGczQgL1+b/2r2g+EqYedCqWcm8B0KryJnEicwXfHgzJY2masjoF5G Fkj2Sv1EeyWY8ckdQ5TCl7O8l3OP4iNffTqkUi6KUhBMCvW0FbKMQSnEDX27CEHgggGkBn/sFB4zc iBhIdqNwZ7QDp4Um4klM1db2XMzsCGv08GUDglexnqvEah9iKrNEu+TWfamME0iqX5IP9ARs9HRS+ n3CEWveF+U3eDsbkiovi2+ebb4u1rwhW1/okbMbLc9ywBwOLdm1Jyize/tnfpw16eebMsnaDUdpRS ZqBUObGQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35908) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pCeBw-0005Bw-TV; Tue, 03 Jan 2023 10:06:44 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCeBu-0001xj-1a; Tue, 03 Jan 2023 10:06:42 +0000 Date: Tue, 3 Jan 2023 10:06:42 +0000 From: "Russell King (Oracle)" To: Hui Tang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: Re: [bug-report] possible performance problem in ret_to_user_from_irq Message-ID: References: <7ecb8f3c-2aeb-a905-0d4a-aa768b9649b5@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7ecb8f3c-2aeb-a905-0d4a-aa768b9649b5@huawei.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 26, 2022 at 04:45:20PM +0800, Hui Tang wrote: > hi folks. > > I found a performance problem which is introduced by commit > 32d59773da38 ("arm: add support for TIF_NOTIFY_SIGNAL"). > After the commit, any bit in the range of 0..15 will cause > do_work_pending() to be invoked. More frequent do_work_pending() > invoked possible result in worse performance. > > Some of the tests I've doneļ¼Œ as follows: > lmbench test base with patch > ./lat_ctx -P 1 -s 0 2 7.3167 11.04 > ./lat_ctx -P 1 -s 16 2 8.0467 14.5367 > ./lat_ctx -P 1 -s 64 2 7.8667 11.43 > ./lat_ctx -P 1 -s 16 16 16.47 18.3667 > ./lat_pipe -P 1 28.1671 44.7904 > > libMicro-0.4.1 test base with patch > ./cascade_cond -E -C 200\ > -L -S -W -N "c_cond_1" -I 100 286.3333 358 > > When I adjust test bit, the performance problem gone. > - movs r1, r1, lsl #16 > + ldr r2, =#_TIF_WORK_MASK > + tst r1, r2 > > Does anyone have a good suggestion for this problem? > should just test _TIF_WORK_MASK, as before? I think it should be fine - but I would suggest re-organising the TIF definitions so that those TIF bits that shouldn't trigger do_work_pending are not in the first 16 bits. Note that all four bits in _TIF_SYSCALL_WORK need to stay within an 8-bit even-bit-aligned range, so the value is suitable for an immediate assembly constant. I'd suggest moving the TIF definitions for 20 to 19, and 4..7 to 20..23, and then 8 to 4. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!