[dpdk-dev] [PATCH] kni: add support for core_id param in single threaded mode

Vladyslav Buslov Vladyslav.Buslov at harmonicinc.com
Wed Sep 21 19:15:19 CEST 2016


> On 9/20/2016 7:36 PM, Stephen Hemminger wrote:
> > On Tue, 20 Sep 2016 21:16:37 +0300
> > Vladyslav Buslov <vladyslav.buslov at harmonicinc.com> wrote:
> >
> >> @@ -123,6 +125,9 @@ static int __net_init kni_init_net(struct net *net)
> >>  	/* Clear the bit of device in use */
> >>  	clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use);
> >>
> >> +	mutex_init(&knet->kni_kthread_lock);
> >> +	knet->kni_kthread = NULL;
> >> +
> >
> > Why not just use kzalloc() here? You would still need to init the
> > mutex etc, but it would be safer.
> >
> 
> Hi Vladyslav,
> 
> This is good suggestion, if you send a new version for this update, please
> keep my Ack.
> 
> Thanks,
> ferruh

Hi Ferruh, Stephen,

Could you please elaborate on using kzalloc for this code.
Currently kni_thread_lock is value member of kni_net structure and never explicitly allocated or deallocated.
Kni_kthread is pointer member of kni_net and is implicitly created and destroyed by kthread_run, kthread_stop functions.
Which one of those do you suggest to allocate with kzalloc() and how would it improve safety?

Sorry for not being able to follow your code review but my Kernel programming experience is somewhat limited.

Thanks,
Vladyslav


More information about the dev mailing list