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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham 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 E0DA4C43381 for ; Tue, 26 Feb 2019 16:10:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CC282147C for ; Tue, 26 Feb 2019 16:10:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="rYVFM1UI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfBZQKE (ORCPT ); Tue, 26 Feb 2019 11:10:04 -0500 Received: from mail-eopbgr50085.outbound.protection.outlook.com ([40.107.5.85]:56699 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726507AbfBZQKE (ORCPT ); Tue, 26 Feb 2019 11:10:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oqd8a8KcPW9WrIWyv+/n4vhc337n8CAT5ic90TY5FXU=; b=rYVFM1UILBBs6i2sixOaKuwSVLD8aUJMO7CSRM0siGG4AAABKV/qCXmG35a4N5Ga+F4PPVNOHyiOMEqH8LivxpyZJidW7fR19D4Z1J+7cSJuJe6buWRH6uPx1u0y4mkzLG/LKZ6xlLiZ6WNACul8dAmArEs1jDI5qhkvx/u7rvI= Received: from HE1PR0502MB3641.eurprd05.prod.outlook.com (10.167.127.11) by HE1PR0502MB3852.eurprd05.prod.outlook.com (10.167.143.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.18; Tue, 26 Feb 2019 16:09:58 +0000 Received: from HE1PR0502MB3641.eurprd05.prod.outlook.com ([fe80::b03d:8cd4:d259:f749]) by HE1PR0502MB3641.eurprd05.prod.outlook.com ([fe80::b03d:8cd4:d259:f749%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 16:09:58 +0000 From: Vlad Buslov To: Cong Wang CC: Linux Kernel Network Developers , Jamal Hadi Salim , Jiri Pirko , David Miller Subject: Re: [PATCH net-next] net: sched: don't release block->lock when dumping chains Thread-Topic: [PATCH net-next] net: sched: don't release block->lock when dumping chains Thread-Index: AQHUzSE2Z57toeAqHUiQqsqlEQimbKXxNogAgAEKngA= Date: Tue, 26 Feb 2019 16:09:58 +0000 Message-ID: References: <20190225154544.10453-1-vladbu@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0362.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::14) To HE1PR0502MB3641.eurprd05.prod.outlook.com (2603:10a6:7:85::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vladbu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a116f196-8c49-477f-0d26-08d69c04da6b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:HE1PR0502MB3852; x-ms-traffictypediagnostic: HE1PR0502MB3852: x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vz4KKN/HN+Eolhu7OfKOcgtUjTfGS1poVMMHuAOzEJ/xJuqG0?= =?iso-8859-1?Q?26R7xDr4tA/K2jPRmowdx0NF7x3pK69boqKq1CgNjXOc1SEoVuRwTyNBZH?= =?iso-8859-1?Q?iIRT3xlEAOoOytDb7RX0oUboyeQrEhr6rhKuL2q86xdxUcZ03vraEK/7JM?= =?iso-8859-1?Q?djCzRSpzJO3oWDRXNwrasMGmRYntxy4DRG3Xpe9APZ9hHifnJmNiNLSIrP?= =?iso-8859-1?Q?zw2x5ZodUnAhBCA/4WXE9mtEMaufuOS5wWwH4gD63YIdYe1fYQZaLBcv6F?= =?iso-8859-1?Q?yo+WyiLV+aVXE9la5JMnXuSdZOxnbWublGMBLANRfMFMM0QGJuWd6IBefz?= =?iso-8859-1?Q?YJh2v6lBf91IO5hdPOYLChilm2iP35HZWBWGBdXCcrAF8JFCcMUDCwzsKI?= =?iso-8859-1?Q?/+XjMHMBHUwDgS73Xtu8Oa6WLe3h5oSoG6RpWWPWGSd7R75rkQ1hovTbmj?= =?iso-8859-1?Q?uXhIIMIZhZtoC2bL7A2O3yzq0?= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(346002)(366004)(376002)(396003)(51914003)(199004)(189003)(8676002)(81166006)(81156014)(446003)(6486002)(6116002)(3846002)(2616005)(11346002)(186003)(476003)(486006)(7736002)(305945005)(36756003)(106356001)(105586002)(229853002)(26005)(14454004)(4326008)(6916009)(25786009)(14444005)(256004)(6246003)(2906002)(6512007)(478600001)(97736004)(71200400001)(71190400001)(66066001)(68736007)(316002)(86362001)(6436002)(8936002)(76176011)(54906003)(99286004)(6506007)(5660300002)(102836004)(386003)(53546011)(52116002)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0502MB3852;H:HE1PR0502MB3641.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gQd2/GUFuDLFusNxrcpGcD0fHDQUzyg0Ioox3z2eVVaSs6Z0oGLYVErejSX8L6V4env+sSZoCGURMzYLXGvTFAudFkHq82Hxi50ZxqQAJVO2hymghC+3LjlLoa+y54bc7fJoBCVn6df9oAdbGRZZfh/8DTTZ0oyf/GxKTgoS5i/mpuRipGbFaoxk5yglnrofNrkLf540JSEW6b3x7vAdYQFhhY3JQisTgdrE8GInKY81Usf9E4s1h4OoLaapCpNlWaBACGrTz9fb4RntrHHWsINQAauRwspIZITKNTy4akTCLLzEiGhChsD5JWA1GRvm/iJeWVUH2X/Q249Hkwpuyuba1KvipNo5ThhiLy8l03AH9IxwSVN8sjuj46FpDi96zqNAnqGBsNo/OGwV40JK61lfBUB9v3w2BpRecOXtvJQ= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a116f196-8c49-477f-0d26-08d69c04da6b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 16:09:56.9688 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3852 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue 26 Feb 2019 at 00:15, Cong Wang wrote: > On Mon, Feb 25, 2019 at 7:45 AM Vlad Buslov wrote: >> >> Function tc_dump_chain() obtains and releases block->lock on each iterat= ion >> of its inner loop that dumps all chains on block. Outputting chain templ= ate >> info is fast operation so locking/unlocking mutex multiple times is an >> overhead when lock is highly contested. Modify tc_dump_chain() to only >> obtain block->lock once and dump all chains without releasing it. >> >> Signed-off-by: Vlad Buslov >> Suggested-by: Cong Wang > > Thanks for the followup! > > Isn't it similar for __tcf_get_next_proto() in tcf_chain_dump()? > And for tc_dump_tfilter()? Not really. These two dump all tp filters and not just a template, which is O(n) on number of filters and can be slow because it calls hw offload API for each of them. Our typical use-case involves periodic filter dump (to update stats) while multiple concurrent user-space threads are updating filters, so it is important for them to be able to execute in parallel.