netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: Sukadev Bhattiprolu <sukadev@linux.ibm.com>, netdev@vger.kernel.org
Cc: Dany Madden <drt@linux.ibm.com>, Lijun Pan <ljp@linux.ibm.com>,
	Rick Lindsley <ricklind@linux.ibm.com>
Subject: Re: [PATCH net-next v2 3/7] ibmvnic: avoid allocating rwi entries
Date: Tue, 12 Jan 2021 11:48:58 -0800	[thread overview]
Message-ID: <ee2fe19334bc8a23009df4cf1c54731bacb7d95c.camel@kernel.org> (raw)
In-Reply-To: <20210112181441.206545-4-sukadev@linux.ibm.com>

On Tue, 2021-01-12 at 10:14 -0800, Sukadev Bhattiprolu wrote:
> Whenever we need to schedule a reset, we allocate an rwi (reset work
> item?) entry and add to the list of pending resets.
> 
> Since we only add one rwi for a given reason type to the list (no
> duplicates).
> we will only have a handful of reset types in the list - even in the
> worst case. In the common case we should just have a couple of
> entries
> at most.
> 
> Rather than allocating/freeing every time (and dealing with the
> corner
> case of the allocation failing), use a fixed number of rwi entries.
> The extra memory needed is tiny and most of it will be used over the
> active life of the adapter.
> 
> This also fixes a couple of tiny memory leaks. One is in
> ibmvnic_reset()
> where we don't free the rwi entries after deleting them from the list
> due
> to a transport event.  The second is in __ibmvnic_reset() where if we
> find that the adapter is being removed, we simply break out of the
> loop
> (with rc = EBUSY) but ignore any rwi entries that remain on the list.
> 
> Fixes: 2770a7984db58 ("Introduce hard reset recovery")
> Fixes: 36f1031c51a2 ("ibmvnic: Do not process reset during or after
> device removal")
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 123 +++++++++++++++++--------
> ----
>  drivers/net/ethernet/ibm/ibmvnic.h |  14 ++--
>  2 files changed, 78 insertions(+), 59 deletions(-)
> 

[...]

> -enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
> +enum ibmvnic_reset_reason {VNIC_RESET_UNUSED = 0,
> +			   VNIC_RESET_FAILOVER = 1,
>  			   VNIC_RESET_MOBILITY,
>  			   VNIC_RESET_FATAL,
>  			   VNIC_RESET_NON_FATAL,
>  			   VNIC_RESET_TIMEOUT,
> -			   VNIC_RESET_CHANGE_PARAM};
> -
> -struct ibmvnic_rwi {
> -	enum ibmvnic_reset_reason reset_reason;
> -	struct list_head list;
> -};
> +			   VNIC_RESET_CHANGE_PARAM,
> +			   VNIC_RESET_MAX};	// must be last
       this is not the preferred comment style: ^^

I would just drop the comment here, it is clear from the name of the
enum.




  reply	other threads:[~2021-01-12 19:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 18:14 [PATCH net-next v2 0/7] ibmvnic: Use more consistent locking Sukadev Bhattiprolu
2021-01-12 18:14 ` [PATCH net-next v2 1/7] ibmvnic: restore state in change-param reset Sukadev Bhattiprolu
2021-01-12 18:35   ` Dany Madden
2021-01-12 18:14 ` [PATCH net-next v2 2/7] ibmvnic: update reset function prototypes Sukadev Bhattiprolu
2021-01-12 18:14 ` [PATCH net-next v2 3/7] ibmvnic: avoid allocating rwi entries Sukadev Bhattiprolu
2021-01-12 19:48   ` Saeed Mahameed [this message]
2021-01-13  1:15     ` Sukadev Bhattiprolu
2021-01-12 18:14 ` [PATCH net-next v2 4/7] ibmvnic: switch order of checks in ibmvnic_reset Sukadev Bhattiprolu
2021-01-12 18:14 ` [PATCH net-next v2 5/7] ibmvnic: serialize access to work queue Sukadev Bhattiprolu
2021-01-12 19:56   ` Saeed Mahameed
2021-01-13  0:40     ` Sukadev Bhattiprolu
2021-01-13  1:56       ` Jakub Kicinski
2021-01-12 18:14 ` [PATCH net-next v2 6/7] ibmvnic: check adapter->state under state_lock Sukadev Bhattiprolu
2021-01-12 18:14 ` [PATCH net-next v2 7/7] ibmvnic: add comments about state_lock Sukadev Bhattiprolu
2021-01-12 20:00 ` [PATCH net-next v2 0/7] ibmvnic: Use more consistent locking Saeed Mahameed
2021-01-13  2:00 ` Jakub Kicinski
2021-01-13  4:42   ` Sukadev Bhattiprolu
2021-01-13 18:57     ` Jakub Kicinski
2021-01-13 19:55       ` Sukadev Bhattiprolu
2021-01-14  2:35   ` Sukadev Bhattiprolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee2fe19334bc8a23009df4cf1c54731bacb7d95c.camel@kernel.org \
    --to=saeed@kernel.org \
    --cc=drt@linux.ibm.com \
    --cc=ljp@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=ricklind@linux.ibm.com \
    --cc=sukadev@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).