Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	"Allan W . Nielsen" <allan.nielsen@microchip.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Steen Hegelund <steen.hegelund@microchip.com>
Subject: Re: [PATCH v3 net-next] net: mscc: ocelot: install MAC addresses in .ndo_set_rx_mode from process context
Date: Wed, 9 Dec 2020 01:56:14 +0000	[thread overview]
Message-ID: <20201209015613.b35hn6u4jgd5afb4@skbuf> (raw)
In-Reply-To: <20201207170937.2bed0b40@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com>

On Mon, Dec 07, 2020 at 05:09:37PM -0800, Jakub Kicinski wrote:
> > +	ocelot->owq = alloc_ordered_workqueue("ocelot-owq", WQ_MEM_RECLAIM);
>
> Why MEM_RECLAIM ?

Ok, fine, I admit, I copied it.

After reading the documentation a bit more thoroughly, I am still as
clear about the guidelines as before. The original logic was, I am
allocating a memory area and then freeing it from the work item. So it
must be beneficial for the kernel to want to flush this workqueue during
the memory reclaim process / under memory pressure, because I am doing
no memory allocation, and I am also freeing some memory in fact.

The thing is, there are already a lot of users of WQ_MEM_RECLAIM. Many
outside of the filesystem/block subsystems. Not sure if all of them
misuse it, or how to even tell which one constitutes a correct example
of usage for WQ_MEM_RECLAIM.

> > +	if (!ocelot->owq)
> > +		return -ENOMEM;
>
> I don't think you can pass NULL to destroy_workqueue() so IDK how this
> code does error handling (freeing of ocelot->stats_queue if owq fails).

It doesn't.

> >  	INIT_LIST_HEAD(&ocelot->multicast);
> >  	INIT_LIST_HEAD(&ocelot->pgids);
> >  	ocelot_mact_init(ocelot);
> > @@ -1619,6 +1623,7 @@ void ocelot_deinit(struct ocelot *ocelot)
> >  {
> >  	cancel_delayed_work(&ocelot->stats_work);
> >  	destroy_workqueue(ocelot->stats_queue);
> > +	destroy_workqueue(ocelot->owq);
> >  	mutex_destroy(&ocelot->stats_lock);
> >  }
>
> > +static int ocelot_enqueue_mact_action(struct ocelot *ocelot,
> > +				      const struct ocelot_mact_work_ctx *ctx)
> > +{
> > +	struct ocelot_mact_work_ctx *w = kmalloc(sizeof(*w), GFP_ATOMIC);
> > +
> > +	if (!w)
> > +		return -ENOMEM;
> > +
> > +	memcpy(w, ctx, sizeof(*w));
>
> kmemdup()?

Ok.

  reply	other threads:[~2020-12-09  1:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05  0:43 [PATCH v3 net-next] net: mscc: ocelot: install MAC addresses in .ndo_set_rx_mode from process context Vladimir Oltean
2020-12-08  1:09 ` Jakub Kicinski
2020-12-09  1:56   ` Vladimir Oltean [this message]
2020-12-09 18:25     ` Jakub Kicinski

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=20201209015613.b35hn6u4jgd5afb4@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steen.hegelund@microchip.com \
    --cc=vivien.didelot@gmail.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