Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3118665pxm; Mon, 28 Feb 2022 12:24:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhI6oPThDcZic1JFn+B+WTSyLmwyNb1Mqqc/aSKwQ2bBtGgCSPRrfbQCtb+hI7Zww1fkrV X-Received: by 2002:a17:902:9b95:b0:151:533b:9197 with SMTP id y21-20020a1709029b9500b00151533b9197mr11001073plp.66.1646079895516; Mon, 28 Feb 2022 12:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646079895; cv=none; d=google.com; s=arc-20160816; b=bSBPl5vmaxXcuT4+NQrIthl8QgwDNSZYePOv4O0EfMqEoROV1IaANRssGHcUBGzmgQ olqjtC3P4msdeTFSGp7DaRmG7JFy77kzF6TXiap0mRsobxXZ8wEsqM7WhqLcI2cRjszt 6MgMDo9tlAo2tHgVB0b2YXJy7evPGq9tO3yDbob2jojiAIJqMDSW6yD3bBHqVsM1SzgM +IwT8WT/CzNHY5Bd1PYca8pavFFWs+P4JHDyecUu676IhEr18/Z8TSokZGffGelbOK+x gcKV6ErSLXbtvlhM3cLq2uAxjrouRZwCxOrRt/GV8MFyDAFY6YMeGp2O1RJHj52YD75h 3xhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pHdEuKEkd902hTVEo6jYXURoGn3AhpKkEE5zTuWnSks=; b=DdMZWYit0y/ep2C8Y6xRwl2go67RCzpN1fPpItUitLEgC7VGbZjC2Jx3hoCiHF5zce HJMCF9M80QaFhaNwhkenVKAkFO5RlithbuUuqh9MiTTpMEhYjg/nEGi08TcTXonEQZv+ BL1W5KATMRkO2rSQIX+Udk1DrRTErO/hxkZgsbhLHAJb7QJAg4uNNAC/1GoGcDfViRMB AqOk5LhwsXV9ubV7/CzuoNvHUc/j2MocC6NFSo8g+SR3w2w/si/uY40m2d3s3oSoSKQp yK5TRsGqaW2+yjE2LGfSrbej9X9PST+x3gVtqDhjvCrttaH5QWLtl6zYicwXx902xTyD tYZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GDEqV8+T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mg6-20020a17090b370600b001bc64b04774si366227pjb.97.2022.02.28.12.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:24:55 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GDEqV8+T; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 761DF1E5219; Mon, 28 Feb 2022 11:43:55 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240758AbiB1SJL (ORCPT + 99 others); Mon, 28 Feb 2022 13:09:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240247AbiB1SDU (ORCPT ); Mon, 28 Feb 2022 13:03:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5B4B16F7; Mon, 28 Feb 2022 09:46:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B321F60BBF; Mon, 28 Feb 2022 17:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4C48C340E7; Mon, 28 Feb 2022 17:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646070399; bh=/hFzPLZdxNyr7sNhIlWRmhRcp4xlGHvWKKPXk1bmKxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDEqV8+TQD5/jEIq4KrqvsqwYaWaMbd4P2NhueKcrcxi5NydgJXSYTgYUzTcH4KeN scej+6bLNWjFL9X94Az4x4+rukO0WD8em1bBg7N1mq4WB1It4KQg9COh61tdSYIIUy BPbSgDe8srrJY00UVWssroxO6R4VMhx3Y3+TV5jE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yevgeny Kliteynik , Alex Vesker , Saeed Mahameed Subject: [PATCH 5.16 093/164] net/mlx5: DR, Fix the threshold that defines when pool sync is initiated Date: Mon, 28 Feb 2022 18:24:15 +0100 Message-Id: <20220228172408.235458838@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172359.567256961@linuxfoundation.org> References: <20220228172359.567256961@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Yevgeny Kliteynik commit ecd9c5cd46e013659e2fad433057bad1ba66888e upstream. When deciding whether to start syncing and actually free all the "hot" ICM chunks, we need to consider the type of the ICM chunks that we're dealing with. For instance, the amount of available ICM for MODIFY_ACTION is significantly lower than the usual STE ICM, so the threshold should account for that - otherwise we can deplete MODIFY_ACTION memory just by creating and deleting the same modify header action in a continuous loop. This patch replaces the hard-coded threshold with a dynamic value. Fixes: 1c58651412bb ("net/mlx5: DR, ICM memory pools sync optimization") Signed-off-by: Yevgeny Kliteynik Reviewed-by: Alex Vesker Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c | 11 ++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c @@ -4,7 +4,6 @@ #include "dr_types.h" #define DR_ICM_MODIFY_HDR_ALIGN_BASE 64 -#define DR_ICM_SYNC_THRESHOLD_POOL (64 * 1024 * 1024) struct mlx5dr_icm_pool { enum mlx5dr_icm_type icm_type; @@ -324,10 +323,14 @@ dr_icm_chunk_create(struct mlx5dr_icm_po static bool dr_icm_pool_is_sync_required(struct mlx5dr_icm_pool *pool) { - if (pool->hot_memory_size > DR_ICM_SYNC_THRESHOLD_POOL) - return true; + int allow_hot_size; - return false; + /* sync when hot memory reaches half of the pool size */ + allow_hot_size = + mlx5dr_icm_pool_chunk_size_to_byte(pool->max_log_chunk_sz, + pool->icm_type) / 2; + + return pool->hot_memory_size > allow_hot_size; } static int dr_icm_pool_sync_all_buddy_pools(struct mlx5dr_icm_pool *pool)