mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
net: remove SK_MEM_QUANTUM and SK_MEM_QUANTUM_SHIFT
Due to memcg interface, SK_MEM_QUANTUM is effectively PAGE_SIZE. This might change in the future, but it seems better to avoid the confusion. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
e70f3c7012
commit
100fdd1faf
@@ -1532,8 +1532,6 @@ int __sk_mem_schedule(struct sock *sk, int size, int kind);
|
||||
void __sk_mem_reduce_allocated(struct sock *sk, int amount);
|
||||
void __sk_mem_reclaim(struct sock *sk, int amount);
|
||||
|
||||
#define SK_MEM_QUANTUM ((int)PAGE_SIZE)
|
||||
#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
|
||||
#define SK_MEM_SEND 0
|
||||
#define SK_MEM_RECV 1
|
||||
|
||||
@@ -1545,7 +1543,7 @@ static inline long sk_prot_mem_limits(const struct sock *sk, int index)
|
||||
|
||||
static inline int sk_mem_pages(int amt)
|
||||
{
|
||||
return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT;
|
||||
return (amt + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||
}
|
||||
|
||||
static inline bool sk_has_account(struct sock *sk)
|
||||
@@ -1594,7 +1592,7 @@ static inline void sk_mem_reclaim(struct sock *sk)
|
||||
|
||||
reclaimable = sk->sk_forward_alloc - sk_unused_reserved_mem(sk);
|
||||
|
||||
if (reclaimable >= SK_MEM_QUANTUM)
|
||||
if (reclaimable >= (int)PAGE_SIZE)
|
||||
__sk_mem_reclaim(sk, reclaimable);
|
||||
}
|
||||
|
||||
@@ -1613,7 +1611,7 @@ static inline void sk_mem_reclaim_partial(struct sock *sk)
|
||||
|
||||
reclaimable = sk->sk_forward_alloc - sk_unused_reserved_mem(sk);
|
||||
|
||||
if (reclaimable > SK_MEM_QUANTUM)
|
||||
if (reclaimable > (int)PAGE_SIZE)
|
||||
__sk_mem_reclaim(sk, reclaimable - 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user