[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201209015613.b35hn6u4jgd5afb4@skbuf>
Date: Wed, 9 Dec 2020 01:56:14 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "David S . Miller" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
"Allan W . Nielsen" <allan.nielsen@...rochip.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Steen Hegelund <steen.hegelund@...rochip.com>
Subject: Re: [PATCH v3 net-next] net: mscc: ocelot: install MAC addresses in
.ndo_set_rx_mode from process context
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.
Powered by blists - more mailing lists