Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rhashtable: Use __always_inline instead of inline

Sometimes, the compiler is not clever enough to inline the
rhashtable_lookup() for us, even if the "obj_cmpfn" and "key_len" in
params is const. This can introduce more overhead.

Therefore, use __always_inline for the rhashtable.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Menglong Dong and committed by
Herbert Xu
15443445 ab315f72

+21 -21
+21 -21
include/linux/rhashtable.h
··· 122 122 return hash & (tbl->size - 1); 123 123 } 124 124 125 - static inline unsigned int rht_key_get_hash(struct rhashtable *ht, 125 + static __always_inline unsigned int rht_key_get_hash(struct rhashtable *ht, 126 126 const void *key, const struct rhashtable_params params, 127 127 unsigned int hash_rnd) 128 128 { ··· 152 152 return hash; 153 153 } 154 154 155 - static inline unsigned int rht_key_hashfn( 155 + static __always_inline unsigned int rht_key_hashfn( 156 156 struct rhashtable *ht, const struct bucket_table *tbl, 157 157 const void *key, const struct rhashtable_params params) 158 158 { ··· 161 161 return rht_bucket_index(tbl, hash); 162 162 } 163 163 164 - static inline unsigned int rht_head_hashfn( 164 + static __always_inline unsigned int rht_head_hashfn( 165 165 struct rhashtable *ht, const struct bucket_table *tbl, 166 166 const struct rhash_head *he, const struct rhashtable_params params) 167 167 { ··· 586 586 } 587 587 588 588 /* Internal function, do not use. */ 589 - static inline struct rhash_head *__rhashtable_lookup( 589 + static __always_inline struct rhash_head *__rhashtable_lookup( 590 590 struct rhashtable *ht, const void *key, 591 591 const struct rhashtable_params params) 592 592 { ··· 639 639 * 640 640 * Returns the first entry on which the compare function returned true. 641 641 */ 642 - static inline void *rhashtable_lookup( 642 + static __always_inline void *rhashtable_lookup( 643 643 struct rhashtable *ht, const void *key, 644 644 const struct rhashtable_params params) 645 645 { ··· 662 662 * 663 663 * Returns the first entry on which the compare function returned true. 664 664 */ 665 - static inline void *rhashtable_lookup_fast( 665 + static __always_inline void *rhashtable_lookup_fast( 666 666 struct rhashtable *ht, const void *key, 667 667 const struct rhashtable_params params) 668 668 { ··· 689 689 * 690 690 * Returns the list of entries that match the given key. 691 691 */ 692 - static inline struct rhlist_head *rhltable_lookup( 692 + static __always_inline struct rhlist_head *rhltable_lookup( 693 693 struct rhltable *hlt, const void *key, 694 694 const struct rhashtable_params params) 695 695 { ··· 702 702 * function returns the existing element already in hashes if there is a clash, 703 703 * otherwise it returns an error via ERR_PTR(). 704 704 */ 705 - static inline void *__rhashtable_insert_fast( 705 + static __always_inline void *__rhashtable_insert_fast( 706 706 struct rhashtable *ht, const void *key, struct rhash_head *obj, 707 707 const struct rhashtable_params params, bool rhlist) 708 708 { ··· 825 825 * Will trigger an automatic deferred table resizing if residency in the 826 826 * table grows beyond 70%. 827 827 */ 828 - static inline int rhashtable_insert_fast( 828 + static __always_inline int rhashtable_insert_fast( 829 829 struct rhashtable *ht, struct rhash_head *obj, 830 830 const struct rhashtable_params params) 831 831 { ··· 854 854 * Will trigger an automatic deferred table resizing if residency in the 855 855 * table grows beyond 70%. 856 856 */ 857 - static inline int rhltable_insert_key( 857 + static __always_inline int rhltable_insert_key( 858 858 struct rhltable *hlt, const void *key, struct rhlist_head *list, 859 859 const struct rhashtable_params params) 860 860 { ··· 877 877 * Will trigger an automatic deferred table resizing if residency in the 878 878 * table grows beyond 70%. 879 879 */ 880 - static inline int rhltable_insert( 880 + static __always_inline int rhltable_insert( 881 881 struct rhltable *hlt, struct rhlist_head *list, 882 882 const struct rhashtable_params params) 883 883 { ··· 902 902 * Will trigger an automatic deferred table resizing if residency in the 903 903 * table grows beyond 70%. 904 904 */ 905 - static inline int rhashtable_lookup_insert_fast( 905 + static __always_inline int rhashtable_lookup_insert_fast( 906 906 struct rhashtable *ht, struct rhash_head *obj, 907 907 const struct rhashtable_params params) 908 908 { ··· 929 929 * object if it exists, NULL if it did not and the insertion was successful, 930 930 * and an ERR_PTR otherwise. 931 931 */ 932 - static inline void *rhashtable_lookup_get_insert_fast( 932 + static __always_inline void *rhashtable_lookup_get_insert_fast( 933 933 struct rhashtable *ht, struct rhash_head *obj, 934 934 const struct rhashtable_params params) 935 935 { ··· 956 956 * 957 957 * Returns zero on success. 958 958 */ 959 - static inline int rhashtable_lookup_insert_key( 959 + static __always_inline int rhashtable_lookup_insert_key( 960 960 struct rhashtable *ht, const void *key, struct rhash_head *obj, 961 961 const struct rhashtable_params params) 962 962 { ··· 982 982 * object if it exists, NULL if it does not and the insertion was successful, 983 983 * and an ERR_PTR otherwise. 984 984 */ 985 - static inline void *rhashtable_lookup_get_insert_key( 985 + static __always_inline void *rhashtable_lookup_get_insert_key( 986 986 struct rhashtable *ht, const void *key, struct rhash_head *obj, 987 987 const struct rhashtable_params params) 988 988 { ··· 992 992 } 993 993 994 994 /* Internal function, please use rhashtable_remove_fast() instead */ 995 - static inline int __rhashtable_remove_fast_one( 995 + static __always_inline int __rhashtable_remove_fast_one( 996 996 struct rhashtable *ht, struct bucket_table *tbl, 997 997 struct rhash_head *obj, const struct rhashtable_params params, 998 998 bool rhlist) ··· 1074 1074 } 1075 1075 1076 1076 /* Internal function, please use rhashtable_remove_fast() instead */ 1077 - static inline int __rhashtable_remove_fast( 1077 + static __always_inline int __rhashtable_remove_fast( 1078 1078 struct rhashtable *ht, struct rhash_head *obj, 1079 1079 const struct rhashtable_params params, bool rhlist) 1080 1080 { ··· 1115 1115 * 1116 1116 * Returns zero on success, -ENOENT if the entry could not be found. 1117 1117 */ 1118 - static inline int rhashtable_remove_fast( 1118 + static __always_inline int rhashtable_remove_fast( 1119 1119 struct rhashtable *ht, struct rhash_head *obj, 1120 1120 const struct rhashtable_params params) 1121 1121 { ··· 1137 1137 * 1138 1138 * Returns zero on success, -ENOENT if the entry could not be found. 1139 1139 */ 1140 - static inline int rhltable_remove( 1140 + static __always_inline int rhltable_remove( 1141 1141 struct rhltable *hlt, struct rhlist_head *list, 1142 1142 const struct rhashtable_params params) 1143 1143 { ··· 1145 1145 } 1146 1146 1147 1147 /* Internal function, please use rhashtable_replace_fast() instead */ 1148 - static inline int __rhashtable_replace_fast( 1148 + static __always_inline int __rhashtable_replace_fast( 1149 1149 struct rhashtable *ht, struct bucket_table *tbl, 1150 1150 struct rhash_head *obj_old, struct rhash_head *obj_new, 1151 1151 const struct rhashtable_params params) ··· 1208 1208 * Returns zero on success, -ENOENT if the entry could not be found, 1209 1209 * -EINVAL if hash is not the same for the old and new objects. 1210 1210 */ 1211 - static inline int rhashtable_replace_fast( 1211 + static __always_inline int rhashtable_replace_fast( 1212 1212 struct rhashtable *ht, struct rhash_head *obj_old, 1213 1213 struct rhash_head *obj_new, 1214 1214 const struct rhashtable_params params)