Subject: Re: [RFC PATCH net-next 08/12] drop_monitor: Initialize timer and work item upon tracing enable

From: Ido Schimmel <[email-masked]>
Date: Wed, 24 Jul 2019 20:02:37 +0300

On Wed, Jul 24, 2019 at 11:01:20AM +0200, Jiri Pirko wrote:
> Mon, Jul 22, 2019 at 08:31:30PM CEST, [email-masked] wrote:
> > static int net_dm_trace_on_set(struct netlink_ext_ack *extack)
> > {
> >-	int rc;
> >+	int cpu, rc;
> > 
> > 	if (!try_module_get(THIS_MODULE)) {
> > 		NL_SET_ERR_MSG_MOD(extack, "Failed to take reference on module");
> > 		return -ENODEV;
> > 	}
> > 
> >+	for_each_possible_cpu(cpu) {
> >+		struct per_cpu_dm_data *data = &per_cpu(dm_cpu_data, cpu);
> >+
> >+		INIT_WORK(&data->dm_alert_work, send_dm_alert);
> >+		timer_setup(&data->send_timer, sched_send_work, 0);
> 
> So don't you want to remove this initialization from
> init_net_drop_monitor?

It's actually needed because it calls reset_per_cpu_data(), which might
trigger the timer on memory allocation error. I'll try to see if I can
get rid of it. If not, I'll add a comment so that people won't be
tempted to remove it.