From patchwork Fri Jul 28 12:40:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 794856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xJpNw1Cblz9s4q for ; Fri, 28 Jul 2017 22:41:04 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 248C394B; Fri, 28 Jul 2017 12:41:00 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BA2FA727 for ; Fri, 28 Jul 2017 12:40:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1ED3516F for ; Fri, 28 Jul 2017 12:40:56 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OTS009IFWK6W460@mailout2.w1.samsung.com> for ovs-dev@openvswitch.org; Fri, 28 Jul 2017 13:40:54 +0100 (BST) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170728124053eucas1p2d888d0451749e8735d586e7db1c3f040~VfvfWAhBt0285802858eucas1p2d; Fri, 28 Jul 2017 12:40:53 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id E3.09.14140.7D03B795; Fri, 28 Jul 2017 13:40:55 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170728124053eucas1p189d7eafda27597c06d13e37f460ec9b1~VfvexeF_N2898428984eucas1p1T; Fri, 28 Jul 2017 12:40:53 +0000 (GMT) X-AuditID: cbfec7ef-f796a6d00000373c-ee-597b30d7e39b Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F4.FD.20206.4D03B795; Fri, 28 Jul 2017 13:40:52 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OTS0074PWK1JTA0@eusync3.samsung.com>; Fri, 28 Jul 2017 13:40:52 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Fri, 28 Jul 2017 15:40:47 +0300 Message-id: <1501245647-14581-1-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djPc7rXDaojDY71m1hM+3yb3eJK+092 i7mfnjM6MHs8u/mf0aNvyyrGAKYoLpuU1JzMstQifbsErowvp1cxFrzjqfj97jN7A2MjVxcj J4eEgInE3cefmSFsMYkL99azdTFycQgJLGOUuPxwKQuE85lR4sOfWUwwHa+X3WUBscGqXt4r gChqZpLonHuFFSTBJqAjcWr1EUYQW0RAWuJ17xuwOLNAsMSO9cfYQGxhATuJRc+3sYPYLAKq EscWvQSzeQXcJJbPX88GsUxO4ua5Tma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i2x2CiyVXPLU7uKL0vk3/d1W qWm+Fo0QWKAbta30jujxFTc+WWWsnb2D4ew3hpMVM84en6iTsuh/B3PD6+0zGPf9v+ySnjTx W6uQ+3UOlpjf1k29c9+YzYhcacRUHWuusrHD/ehHrXeVsyM0Kj44JqmVHPld9mlprbm04cNl PMIxWkosxRmJhlrMRcWJAD7CRRhCAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170728124053eucas1p189d7eafda27597c06d13e37f460ec9b1 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G+yCvOyEseyghOyekBtMZWFkaW5nIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbTGVhZGluZyBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170728124053eucas1p189d7eafda27597c06d13e37f460ec9b1 X-RootMTR: 20170728124053eucas1p189d7eafda27597c06d13e37f460ec9b1 References: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Heetae Ahn Subject: [ovs-dev] [PATCH] dpif-netdev: Simplify emc replacement policy. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Current EMC replacement policy allows to replace active EMC entry even if there are dead (empty) entries available. This leads to EMC trashing even on few hundreds of flows. In some cases PMD threads starts to execute classifier lookups even in tests with 50 - 100 active flows. Fix this by removing of srtange hash comparison rule from the replacement checking. New behavior also matches the comment that describes replacement policy. This comment wasn't correct before. Testing shows stable work of exact match cache without misses with up to 3072 active flows and only 0.05% of EMC misses with 4096 flows. With higher number of flows there is no significant difference with current implementation. For the reference, number of EMC misses in current master is around 20% for the case with 2048 active flows. Testing performed with 100% EMC insert probability. Signed-off-by: Ilya Maximets --- lib/dpif-netdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 47a9fa0..4a8dd80 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2054,8 +2054,7 @@ emc_insert(struct emc_cache *cache, const struct netdev_flow_key *key, * in the first entry where it can be */ if (!to_be_replaced || (emc_entry_alive(to_be_replaced) - && !emc_entry_alive(current_entry)) - || current_entry->key.hash < to_be_replaced->key.hash) { + && !emc_entry_alive(current_entry))) { to_be_replaced = current_entry; } }