[Devel] [PATCH RHEL8 COMMIT] Revert "net: packet: rx/tx ring pages accounting"

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 13 19:28:55 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.12
------>
commit 712f511eb6d7792d0f9c8c2eb40ddfa77fb59151
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Tue Apr 13 19:28:55 2021 +0300

    Revert "net: packet: rx/tx ring pages accounting"
    
    This reverts commit 5fbf183dd37bc86094200499cbda4d69c5858472.
    Current version of af_packet accounting in vz8 is incorrect.
    It should be re-implemented later
    
    https://jira.sw.ru/browse/PSBM-120694
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/packet/af_packet.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f4bd19532550..cb80d48cad50 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4244,7 +4244,6 @@ static struct pgv *alloc_pg_vec(struct tpacket_req *req, int order)
 static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 		int closing, int tx_ring)
 {
-	struct packet_sk_charge *psc = (struct packet_sk_charge *)sk->sk_memcg;
 	struct pgv *pg_vec = NULL;
 	struct packet_sock *po = pkt_sk(sk);
 	int was_running, order = 0;
@@ -4312,16 +4311,9 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 
 		err = -ENOMEM;
 		order = get_order(req->tp_block_size);
-		if (psc && memcg_charge_kmem(psc->memcg, GFP_KERNEL,
-				(1 << order) * req->tp_block_nr))
-			goto out;
 		pg_vec = alloc_pg_vec(req, order);
-		if (unlikely(!pg_vec)) {
-			if (psc)
-				memcg_uncharge_kmem(psc->memcg,
-					(1 << order) * req->tp_block_nr);
+		if (unlikely(!pg_vec))
 			goto out;
-		}
 		switch (po->tp_version) {
 		case TPACKET_V3:
 			/* Block transmit is not supported yet */
@@ -4399,12 +4391,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 	}
 
 out_free_pg_vec:
-	if (pg_vec) {
-		if (psc)
-			memcg_uncharge_kmem(psc->memcg,
-				(1 << order) * req->tp_block_nr);
+	if (pg_vec)
 		free_pg_vec(pg_vec, order, req->tp_block_nr);
-	}
 out:
 	return err;
 }


More information about the Devel mailing list