Received: by 2002:ab2:7853:0:b0:1fa:5c73:8e2d with SMTP id m19csp5384lqp; Thu, 30 May 2024 10:14:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNKNkAqt3RXa0kMCmOBjEcmfs5x6LosWuidzXqg1eYYU0KKtEKl4l2Jvu5njVSa966aVbI8klBfgxKRgluQb2QN/CxaNLI8CljJRhAyw== X-Google-Smtp-Source: AGHT+IH8QiRWWXofc6Sl/gSMVf8iKARUrum+XXvQsV/qg99b9ywR2eGD7EtPKDuh4KQPqjuArs+z X-Received: by 2002:a50:9b03:0:b0:56e:743:d4d9 with SMTP id 4fb4d7f45d1cf-57a1791a9bfmr1411376a12.42.1717089297422; Thu, 30 May 2024 10:14:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717089297; cv=pass; d=google.com; s=arc-20160816; b=IoO7aDRw/XtfMuDSqCfPmvVHP06ue3IKcaWVaU3ctq1tB8XUlp8p/SiW9SlFBYZM00 fqdm9YYuN/G1RKgdB4dYURmZmeXsgdBvFtAipPXat7XjpBJVLaiGSmhnO0YmY6kNuEwq MYFtEgvLRalFj5YjVpbK7OB56ElKZh77s6SSIGvCOaX9q1zTbgOPRfkRGPBUlYuak5oY jU0ySdpVyIeryz2MoMFEySWtI08tP5QLmynhPvv/JoQY/JmFgdwi6YGXIf1o4AQqPYxi 9D/AsO/r4EYKnMdkJBnXgpeTeE4H4WnFTo/vvpZFBS8EV98yW6qHIu8p9GsFDQPC1TtT 72Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=In2UxaODnjdfo9Hw1yvVfs+/SqcSg4Lhni+L9vDVCuo=; fh=+64WiG8es4y4okUykft8j6IpanNuZ/IIcgKKUylxizU=; b=dY6zpmCIcUjQKd5be52DaGaC/gsjitAa41/dfkWTxH6CnkkWt3+SI/bIpeKP841nYi 5MFJFqHK2Ve2SUsMXRYjfI8/U9HRNlbnj0pG19dIWvO7WdrsTwKGjvsHbUXVoac9aPoX jrbUROSNy32m2MhGWbP7tLwl2eZ8AZ3Va78OTrv+DGDBiyaeVStfhhp5ENZL+iHSC6NF mrai+O+QuQowxqA9ssRLrxFDmD44RQ05bEmJJpx+CBOsvZkEyn+UfXWt2bXyz0IyE5nV G42f7rDCLOWUQuxmIr6FXPH/0RQezBAN+4JxjfF8HgI2hMzejxxDKyeANr0FrRfXdKIF 2SCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cVtnVjqu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195720-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c62eefsi23805a12.240.2024.05.30.10.14.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 10:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195720-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cVtnVjqu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195720-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 25E5C1F21DA3 for ; Thu, 30 May 2024 17:14:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1AB945BF0; Thu, 30 May 2024 17:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cVtnVjqu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9935405FB; Thu, 30 May 2024 17:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089286; cv=none; b=WWvHVc/fvWM9L7eD0khFSz8bx/z5DXrUqcP1XIxg9PfPSqJnzsITnLjoQoOyILVdFSk9dqYD4pB0BYDGUuqoHDVWTUCVzkDIaPTNvsjcvx6FXXe2TgfXXe/r9fnDC/EecuHDEzmjyQOFCSsG48BV6KzC5aWuCXghQXd8Z6Ibe6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717089286; c=relaxed/simple; bh=zmY0ORK1B5BkKpd/9Xan0GjeGKmQu1tubxofXOvTQ3I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mGclEvESfvjTLIgMWMn0wi0Mh/eQfKXAdPfceadR6ZBXnl4fcPYIvPr4jwxT02yt1edpCvhjJqwMDfAu47BKi8CyAA0YZewWxH7g5p+zMJrVJZBq7Tg4v8/Xw/9rTHI9aaYIRFvkDZ3orZ8OHbdOV/jGiP+5dLRe94KDILKULuo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cVtnVjqu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DB8AC2BBFC; Thu, 30 May 2024 17:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717089286; bh=zmY0ORK1B5BkKpd/9Xan0GjeGKmQu1tubxofXOvTQ3I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cVtnVjquT9t/oU24rofoX/VO4hKKAoyUg8nwf1saq/CSo8QiS0jvEMbGyn4uOanMH w2AiX8R+8ATIx0dVLBVrk/PR6vskaGikuVfH6zcvNOsffNnXYx4zlMB6G2rEgC+p9m Q3Wx3u1ArDSN0tOlN4IUvG40geWHH9UBKMAWVRIlKAAgXrCd+2MSbpFDWQ8NEX33+4 OfPS9hkHwCm/3gF4h/bshVJ1cr+d1gW573dmt5+X+DPzaZjcQN/aRDGFyJEbyvcnZD G9UU820BZUuVtIH6GdCWU0uNBXjyNW4GyF14wiex3EZMjG41pTNrSbTHPDiDmvqVQs 5FS6ig9zbaL7Q== Date: Thu, 30 May 2024 20:14:40 +0300 From: Leon Romanovsky To: Anand Khoje Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, rama.nichanamatlu@oracle.com, manjunath.b.patil@oracle.com Subject: Re: [PATCH 1/1] RDMA/mlx5: Release CPU for other processes in mlx5_free_cmd_msg() Message-ID: <20240530171440.GE3884@unreal> References: <20240522033256.11960-1-anand.a.khoje@oracle.com> <20240522033256.11960-2-anand.a.khoje@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240522033256.11960-2-anand.a.khoje@oracle.com> On Wed, May 22, 2024 at 09:02:56AM +0530, Anand Khoje wrote: > In non FLR context, at times CX-5 requests release of ~8 million device pages. > This needs humongous number of cmd mailboxes, which to be released once > the pages are reclaimed. Release of humongous number of cmd mailboxes > consuming cpu time running into many secs, with non preemptable kernels > is leading to critical process starving on that cpu’s RQ. To alleviate > this, this patch relinquishes cpu periodically but conditionally. > > Orabug: 36275016 > > Signed-off-by: Anand Khoje > --- > drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c > index 9c21bce..9fbf25d 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c > @@ -1336,16 +1336,23 @@ static struct mlx5_cmd_msg *mlx5_alloc_cmd_msg(struct mlx5_core_dev *dev, > return ERR_PTR(err); > } > > +#define RESCHED_MSEC 2 > static void mlx5_free_cmd_msg(struct mlx5_core_dev *dev, > struct mlx5_cmd_msg *msg) > { > struct mlx5_cmd_mailbox *head = msg->next; > struct mlx5_cmd_mailbox *next; > + unsigned long start_time = jiffies; > > while (head) { > next = head->next; > free_cmd_box(dev, head); Did you consider to make this function asynchronous and parallel? Thanks > head = next; > + if (time_after(jiffies, start_time + msecs_to_jiffies(RESCHED_MSEC))) { > + mlx5_core_warn_rl(dev, "Spent more than %d msecs, yielding CPU\n", RESCHED_MSEC); > + cond_resched(); > + start_time = jiffies; > + } > } > kfree(msg); > } > -- > 1.8.3.1 > >