Hi Simon, thanks for reviewing!
On 9/1/23 9:59 PM, Simon Horman wrote:
On Fri, Sep 01, 2023 at 02:21:28PM +0800, Abel Wu wrote:
@@ -3087,8 +3100,20 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
if (sk_has_memory_pressure(sk)) {
u64 alloc;
- if (!sk_under_memory_pressure(sk))
+ /* Be more conservative if the socket's memcg (or its
+ * parents) is under reclaim pressure, try to possibly
+ * avoid further memstall.
+ */
+ if (under_memcg_pressure)
+ goto suppress_allocation;
+
+ if (!sk_under_global_memory_pressure(sk))
return 1;
+
+ /* Trying to be fair among all the sockets of same
+ * protocal under global memory pressure, by allowing
nit: checkpatch.pl --codespell says, protocal -> protocol
Will fix in next version.
Thanks,
Abel
+ * the ones that under average usage to raise.
+ */
alloc = sk_sockets_allocated_read_positive(sk);
if (sk_prot_mem_limits(sk, 2) > alloc *
sk_mem_pages(sk->sk_wmem_queued +
--
2.37.3