@@ -73,11 +73,11 @@ static bool selem_linked_to_map(const struct bpf_local_storage_elem *selem)
7373
7474struct bpf_local_storage_elem *
7575bpf_selem_alloc (struct bpf_local_storage_map * smap , void * owner ,
76- void * value , bool charge_mem , bool swap_uptrs , gfp_t gfp_flags )
76+ void * value , bool swap_uptrs , gfp_t gfp_flags )
7777{
7878 struct bpf_local_storage_elem * selem ;
7979
80- if (charge_mem && mem_charge (smap , owner , smap -> elem_size ))
80+ if (mem_charge (smap , owner , smap -> elem_size ))
8181 return NULL ;
8282
8383 if (smap -> bpf_ma ) {
@@ -106,8 +106,7 @@ bpf_selem_alloc(struct bpf_local_storage_map *smap, void *owner,
106106 return selem ;
107107 }
108108
109- if (charge_mem )
110- mem_uncharge (smap , owner , smap -> elem_size );
109+ mem_uncharge (smap , owner , smap -> elem_size );
111110
112111 return NULL ;
113112}
@@ -284,7 +283,7 @@ static void bpf_selem_free_list(struct hlist_head *list, bool reuse_now)
284283 */
285284static bool bpf_selem_unlink_storage_nolock (struct bpf_local_storage * local_storage ,
286285 struct bpf_local_storage_elem * selem ,
287- bool uncharge_mem , struct hlist_head * free_selem_list )
286+ struct hlist_head * free_selem_list )
288287{
289288 struct bpf_local_storage_map * smap ;
290289 bool free_local_storage ;
@@ -297,8 +296,7 @@ static bool bpf_selem_unlink_storage_nolock(struct bpf_local_storage *local_stor
297296 * The owner may be freed once the last selem is unlinked
298297 * from local_storage.
299298 */
300- if (uncharge_mem )
301- mem_uncharge (smap , owner , smap -> elem_size );
299+ mem_uncharge (smap , owner , smap -> elem_size );
302300
303301 free_local_storage = hlist_is_singular_node (& selem -> snode ,
304302 & local_storage -> list );
@@ -393,7 +391,7 @@ static void bpf_selem_unlink_storage(struct bpf_local_storage_elem *selem,
393391 raw_spin_lock_irqsave (& local_storage -> lock , flags );
394392 if (likely (selem_linked_to_storage (selem )))
395393 free_local_storage = bpf_selem_unlink_storage_nolock (
396- local_storage , selem , true, & selem_free_list );
394+ local_storage , selem , & selem_free_list );
397395 raw_spin_unlock_irqrestore (& local_storage -> lock , flags );
398396
399397 bpf_selem_free_list (& selem_free_list , reuse_now );
@@ -582,7 +580,7 @@ bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap,
582580 if (err )
583581 return ERR_PTR (err );
584582
585- selem = bpf_selem_alloc (smap , owner , value , true, swap_uptrs , gfp_flags );
583+ selem = bpf_selem_alloc (smap , owner , value , swap_uptrs , gfp_flags );
586584 if (!selem )
587585 return ERR_PTR (- ENOMEM );
588586
@@ -616,7 +614,7 @@ bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap,
616614 /* A lookup has just been done before and concluded a new selem is
617615 * needed. The chance of an unnecessary alloc is unlikely.
618616 */
619- alloc_selem = selem = bpf_selem_alloc (smap , owner , value , true, swap_uptrs , gfp_flags );
617+ alloc_selem = selem = bpf_selem_alloc (smap , owner , value , swap_uptrs , gfp_flags );
620618 if (!alloc_selem )
621619 return ERR_PTR (- ENOMEM );
622620
@@ -656,7 +654,7 @@ bpf_local_storage_update(void *owner, struct bpf_local_storage_map *smap,
656654 if (old_sdata ) {
657655 bpf_selem_unlink_map (SELEM (old_sdata ));
658656 bpf_selem_unlink_storage_nolock (local_storage , SELEM (old_sdata ),
659- true, & old_selem_free_list );
657+ & old_selem_free_list );
660658 }
661659
662660unlock :
@@ -762,7 +760,7 @@ void bpf_local_storage_destroy(struct bpf_local_storage *local_storage)
762760 * of the loop will set the free_cgroup_storage to true.
763761 */
764762 free_storage = bpf_selem_unlink_storage_nolock (
765- local_storage , selem , true, & free_selem_list );
763+ local_storage , selem , & free_selem_list );
766764 }
767765 raw_spin_unlock_irqrestore (& local_storage -> lock , flags );
768766
0 commit comments