Re: [PATCH 1/3] rhashtable: further improve stability of rhashtable_walk
From: kbuild test robot
Date: Fri Jul 06 2018 - 04:25:44 EST
Hi NeilBrown,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on next-20180705]
[cannot apply to linus/master linux-sof-driver/master v4.18-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/NeilBrown/rhashtable-replace-rhashtable_walk_peek-implementation/20180706-153705
config: i386-randconfig-x078-201826 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
In file included from ipc/util.c:66:0:
include/linux/rhashtable.h: In function '__rhashtable_insert_fast':
>> include/linux/rhashtable.h:624:6: error: 'headp' undeclared (first use in this function); did you mean 'head'?
headp = &head->next;
^~~~~
head
include/linux/rhashtable.h:624:6: note: each undeclared identifier is reported only once for each function it appears in
vim +624 include/linux/rhashtable.h
570
571 /* Internal function, please use rhashtable_insert_fast() instead. This
572 * function returns the existing element already in hashes in there is a clash,
573 * otherwise it returns an error via ERR_PTR().
574 */
575 static inline void *__rhashtable_insert_fast(
576 struct rhashtable *ht, const void *key, struct rhash_head *obj,
577 const struct rhashtable_params params, bool rhlist)
578 {
579 struct rhashtable_compare_arg arg = {
580 .ht = ht,
581 .key = key,
582 };
583 struct rhash_head __rcu **pprev;
584 struct bucket_table *tbl;
585 struct rhash_head *head;
586 spinlock_t *lock;
587 unsigned int hash;
588 int elasticity;
589 void *data;
590
591 rcu_read_lock();
592
593 tbl = rht_dereference_rcu(ht->tbl, ht);
594 hash = rht_head_hashfn(ht, tbl, obj, params);
595 lock = rht_bucket_lock(tbl, hash);
596 spin_lock_bh(lock);
597
598 if (unlikely(rcu_access_pointer(tbl->future_tbl))) {
599 slow_path:
600 spin_unlock_bh(lock);
601 rcu_read_unlock();
602 return rhashtable_insert_slow(ht, key, obj);
603 }
604
605 elasticity = RHT_ELASTICITY;
606 pprev = rht_bucket_insert(ht, tbl, hash);
607 data = ERR_PTR(-ENOMEM);
608 if (!pprev)
609 goto out;
610
611 rht_for_each_continue(head, *pprev, tbl, hash) {
612 struct rhlist_head *plist;
613 struct rhlist_head *list;
614
615 elasticity--;
616 if (!key ||
617 (params.obj_cmpfn ?
618 params.obj_cmpfn(&arg, rht_obj(ht, head)) :
619 rhashtable_compare(&arg, rht_obj(ht, head)))) {
620 if (rhlist) {
621 pprev = &head->next;
622 } else {
623 if (head < obj)
> 624 headp = &head->next;
625 }
626 continue;
627 }
628
629 data = rht_obj(ht, head);
630
631 if (!rhlist)
632 goto out;
633
634
635 list = container_of(obj, struct rhlist_head, rhead);
636 plist = container_of(head, struct rhlist_head, rhead);
637
638 RCU_INIT_POINTER(list->next, plist);
639 head = rht_dereference_bucket(head->next, tbl, hash);
640 RCU_INIT_POINTER(list->rhead.next, head);
641 rcu_assign_pointer(*pprev, obj);
642
643 goto good;
644 }
645
646 if (elasticity <= 0)
647 goto slow_path;
648
649 data = ERR_PTR(-E2BIG);
650 if (unlikely(rht_grow_above_max(ht, tbl)))
651 goto out;
652
653 if (unlikely(rht_grow_above_100(ht, tbl)))
654 goto slow_path;
655
656 head = rht_dereference_bucket(*pprev, tbl, hash);
657
658 RCU_INIT_POINTER(obj->next, head);
659 if (rhlist) {
660 struct rhlist_head *list;
661
662 list = container_of(obj, struct rhlist_head, rhead);
663 RCU_INIT_POINTER(list->next, NULL);
664 }
665
666 rcu_assign_pointer(*pprev, obj);
667
668 atomic_inc(&ht->nelems);
669 if (rht_grow_above_75(ht, tbl))
670 schedule_work(&ht->run_work);
671
672 good:
673 data = NULL;
674
675 out:
676 spin_unlock_bh(lock);
677 rcu_read_unlock();
678
679 return data;
680 }
681
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip