Re: [rcu:dev.2019.09.23a 65/77] kernel//rcu/tree.c:2770:3: error: implicit declaration of function 'kfree'; did you mean 'kvfree'?

From: Paul E. McKenney
Date: Tue Sep 24 2019 - 10:56:33 EST


On Tue, Sep 24, 2019 at 10:21:54AM +0800, kbuild test robot wrote:
> tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2019.09.23a
> head: 97de53b94582c208ee239178b208b8e8b9472585
> commit: 06b68648e6084488b79de47a2cfa307a1b9668b9 [65/77] rcu: Remove kfree_rcu() special casing and lazy-callback handling
> config: x86_64-randconfig-c004-201938 (attached as .config)
> compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
> reproduce:
> git checkout 06b68648e6084488b79de47a2cfa307a1b9668b9
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> kernel//rcu/tree.c: In function 'kfree_rcu_work':
> >> kernel//rcu/tree.c:2770:3: error: implicit declaration of function 'kfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration]
> kfree((void *)head - offset);
> ^~~~~
> kvfree
> cc1: some warnings being treated as errors

Good catch, missing #include of slab.h, fix posted to be squashed with
the original commit.

Thanx, Paul

> vim +2770 kernel//rcu/tree.c
>
> 2739
> 2740 /*
> 2741 * This function is invoked in workqueue context after a grace period.
> 2742 * It frees all the objects queued on ->head_free.
> 2743 */
> 2744 static void kfree_rcu_work(struct work_struct *work)
> 2745 {
> 2746 unsigned long flags;
> 2747 struct rcu_head *head, *next;
> 2748 struct kfree_rcu_cpu *krcp;
> 2749 struct kfree_rcu_cpu_work *krwp;
> 2750
> 2751 krwp = container_of(to_rcu_work(work),
> 2752 struct kfree_rcu_cpu_work, rcu_work);
> 2753 krcp = krwp->krcp;
> 2754 spin_lock_irqsave(&krcp->lock, flags);
> 2755 head = krwp->head_free;
> 2756 krwp->head_free = NULL;
> 2757 spin_unlock_irqrestore(&krcp->lock, flags);
> 2758
> 2759 // List "head" is now private, so traverse locklessly.
> 2760 for (; head; head = next) {
> 2761 unsigned long offset = (unsigned long)head->func;
> 2762
> 2763 next = head->next;
> 2764 // Potentially optimize with kfree_bulk in future.
> 2765 debug_rcu_head_unqueue(head);
> 2766 rcu_lock_acquire(&rcu_callback_map);
> 2767 trace_rcu_invoke_kfree_callback(rcu_state.name, head, offset);
> 2768
> 2769 /* Could be possible to optimize with kfree_bulk in future */
> > 2770 kfree((void *)head - offset);
> 2771
> 2772 rcu_lock_release(&rcu_callback_map);
> 2773 cond_resched_tasks_rcu_qs();
> 2774 }
> 2775 }
> 2776
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation