]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sdp: Limit total memory consumed by rcvbuf
authorAmir Vadai <amirv@mellanox.co.il>
Tue, 8 Mar 2011 08:25:35 +0000 (10:25 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:05:46 +0000 (05:05 -0700)
rcvbuf is already limited by the payload in the queue. But also need to limit
total memory consumption of it, since small packets received might have a very
large overhead to the payload.

Signed-off-by: Amir Vadai <amirv@mellanox.co.il>
drivers/infiniband/ulp/sdp/sdp_rx.c

index 4ecd0877259c2b38dfb97f22fcab7bd72bd717b2..3d054d6dc5006e648f22cfb7aefb1aeca561e8c7 100644 (file)
@@ -282,6 +282,9 @@ static inline int sdp_post_recvs_needed(struct sdp_sock *ssk)
                return 0;
        }
 
+       if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_prot->sysctl_rmem[2])
+               return 0;
+
        return 1;
 }