Skip to contentSkip to conversation

2e685cad5790 build warning

PATCH Applied Johannes Weiner 3 participants 5 messages Dec 4, 2013 – Dec 6, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

Hi Eric,

commit 2e685cad57906e19add7189b5ff49dfb6aaa21d3

Author: Eric W. Biederman <[email protected]>
Date:   Sat Oct 19 16:26:19 2013 -0700

tcp_memcontrol: Kill struct tcp_memcontrol

Replace the pointers in struct cg_proto with actual data fields and kill struct tcp_memcontrol as it is not fully redundant.

This removes a confusing, unnecessary layer of abstraction.

triggers a build warning because it removed the only reference to a function but not the function itself:

linux/net/ipv4/tcp_memcontrol.c:9:13: warning: ‘memcg_tcp_enter_memory_pressure’ defined but not used [-Wunused-function]
static void memcg_tcp_enter_memory_pressure(struct sock *sk)

I can not see from the changelog why this function is no longer used, or who is supposed to now set cg_proto->memory_pressure which you still initialize etc. Either way, the current state does not seem to make much sense. The author would be the best person to double check such changes, but he wasn't copied on your patch, so I copied him now.

Apologies if this has been brought up before, I could not find any reference on LKML of either this patch or a report of this warning.

Thanks!

#1 lore raw

[ botched linux-kernel address in the first try ]

Quoted 28 lines · Johannes Weiner

Hi Eric,

commit 2e685cad57906e19add7189b5ff49dfb6aaa21d3

Author: Eric W. Biederman <[email protected]>
Date:   Sat Oct 19 16:26:19 2013 -0700

tcp_memcontrol: Kill struct tcp_memcontrol

Replace the pointers in struct cg_proto with actual data fields and kill struct tcp_memcontrol as it is not fully redundant.

This removes a confusing, unnecessary layer of abstraction.

triggers a build warning because it removed the only reference to a function but not the function itself:

linux/net/ipv4/tcp_memcontrol.c:9:13: warning: ‘memcg_tcp_enter_memory_pressure’ defined but not used [-Wunused-function]
static void memcg_tcp_enter_memory_pressure(struct sock *sk)

I can not see from the changelog why this function is no longer used, or who is supposed to now set cg_proto->memory_pressure which you still initialize etc. Either way, the current state does not seem to make much sense. The author would be the best person to double check such changes, but he wasn't copied on your patch, so I copied him now.

Quoted 4 lines

Apologies if this has been brought up before, I could not find any reference on LKML of either this patch or a report of this warning.

Thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#2 lore raw
In reply to Johannes Weiner

RnJvbTogSm9oYW5uZXMgV2VpbmVyIDxoYW5uZXNAY21weGNoZy5vcmc+DQpEYXRlOiBXZWQsIDQg RGVjIDIwMTMgMTc6Mjk6NDMgLTA1MDANCg0KPiBsaW51eC9uZXQvaXB2NC90Y3BfbWVtY29udHJv bC5jOjk6MTM6IHdhcm5pbmc6IKFtZW1jZ190Y3BfZW50ZXJfbWVtb3J5X3ByZXNzdXJloiBkZWZp bmVkIGJ1dCBub3QgdXNlZCBbLVd1bnVzZWQtZnVuY3Rpb25dDQo+ICBzdGF0aWMgdm9pZCBtZW1j Z190Y3BfZW50ZXJfbWVtb3J5X3ByZXNzdXJlKHN0cnVjdCBzb2NrICpzaykNCg0KQWxzbywgYW11 c2luZ2x5LCBhbHRob3VnaCBzdGF0aWMgdGhlcmUgaXMgYW4gRVhQT1JUX1NZTUJPTCgpIGZvciBp dC4NCg0KPiANCj4gSSBjYW4gbm90IHNlZSBmcm9tIHRoZSBjaGFuZ2Vsb2cgd2h5IHRoaXMgZnVu Y3Rpb24gaXMgbm8gbG9uZ2VyIHVzZWQsDQo+IG9yIHdobyBpcyBzdXBwb3NlZCB0byBub3cgc2V0 IGNnX3Byb3RvLT5tZW1vcnlfcHJlc3N1cmUgd2hpY2ggeW91DQo+IHN0aWxsIGluaXRpYWxpemUg ZXRjLiAgRWl0aGVyIHdheSwgdGhlIGN1cnJlbnQgc3RhdGUgZG9lcyBub3Qgc2VlbSB0bw0KPiBt YWtlIG11Y2ggc2Vuc2UuICBUaGUgYXV0aG9yIHdvdWxkIGJlIHRoZSBiZXN0IHBlcnNvbiB0byBk b3VibGUgY2hlY2sNCj4gc3VjaCBjaGFuZ2VzLCBidXQgaGUgd2Fzbid0IGNvcGllZCBvbiB5b3Vy IHBhdGNoLCBzbyBJIGNvcGllZCBoaW0gbm93Lg0KDQpFcmljLCBwbGVhc2UgcmVzb2x2ZSB0aGlz Lg0K

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH 1/1 tcp_memcontrol: Cleanup/fix cg_proto->memory_pressure handling.

kill memcg_tcp_enter_memory_pressure. The only function of memcg_tcp_enter_memory_pressure was to reduce deal with the unnecessary abstraction that was tcp_memcontrol. Now that struct tcp_memcontrol is gone remove this unnecessary function, the unnecessary function pointer, and modify sk_enter_memory_pressure to set this field directly, just as sk_leave_memory_pressure cleas this field directly.

This fixes a small bug I intruduced when killing struct tcp_memcontrol that caused memcg_tcp_enter_memory_pressure to never be called and thus failed to ever set cg_proto->memory_pressure.

Remove the cg_proto enter_memory_pressure function as it now serves no useful purpose.

Don't test cg_proto->memory_presser in sk_leave_memory_pressure before clearing it. The test was originally there to ensure that the pointer was non-NULL. Now that cg_proto is not a pointer the pointer does not matter.

---
 include/net/sock.h        |    6 ++----
 net/ipv4/tcp_memcontrol.c |    7 -------
 2 files changed, 2 insertions(+), 11 deletions(-)
include/net/sock.h +2 -4
index e3a18ff0c38b..2ef3c3eca47a 100644
@@ -1035,7 +1035,6 @@ enum cg_proto_flags {
 };
 
 struct cg_proto {
-	void			(*enter_memory_pressure)(struct sock *sk);
 	struct res_counter	memory_allocated;	/* Current allocated memory. */
 	struct percpu_counter	sockets_allocated;	/* Current number of sockets. */
 	int			memory_pressure;
@@ -1155,8 +1154,7 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
 		struct proto *prot = sk->sk_prot;
 
 		for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
-			if (cg_proto->memory_pressure)
-				cg_proto->memory_pressure = 0;
+			cg_proto->memory_pressure = 0;
 	}
 
 }
@@ -1171,7 +1169,7 @@ static inline void sk_enter_memory_pressure(struct sock *sk)
 		struct proto *prot = sk->sk_prot;
 
 		for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
-			cg_proto->enter_memory_pressure(sk);
+			cg_proto->memory_pressure = 1;
 	}
 
 	sk->sk_prot->enter_memory_pressure(sk);
net/ipv4/tcp_memcontrol.c +0 -7
index 03e9154f7e68..2c39f8f0dddf 100644
@@ -6,13 +6,6 @@
 #include <linux/memcontrol.h>
 #include <linux/module.h>
 
-static void memcg_tcp_enter_memory_pressure(struct sock *sk)
-{
-	if (sk->sk_cgrp->memory_pressure)
-		sk->sk_cgrp->memory_pressure = 1;
-}
-EXPORT_SYMBOL(memcg_tcp_enter_memory_pressure);
-
 int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss)
 {
 	/*
Signature · 1 line
1.7.5.4
maintainer Applied
#4 lore raw

Re: [PATCH] tcp_memcontrol: Cleanup/fix cg_proto->memory_pressure handling.

From: [email protected] (Eric W. Biederman)
Date: Wed, 04 Dec 2013 20:12:04 -0800

Quoted 16 lines

kill memcg_tcp_enter_memory_pressure. The only function of memcg_tcp_enter_memory_pressure was to reduce deal with the unnecessary abstraction that was tcp_memcontrol. Now that struct tcp_memcontrol is gone remove this unnecessary function, the unnecessary function pointer, and modify sk_enter_memory_pressure to set this field directly, just as sk_leave_memory_pressure cleas this field directly.

This fixes a small bug I intruduced when killing struct tcp_memcontrol that caused memcg_tcp_enter_memory_pressure to never be called and thus failed to ever set cg_proto->memory_pressure.

Remove the cg_proto enter_memory_pressure function as it now serves no useful purpose.

Quoted 6 lines

Don't test cg_proto->memory_presser in sk_leave_memory_pressure before clearing it. The test was originally there to ensure that the pointer was non-NULL. Now that cg_proto is not a pointer the pointer does not matter.

Applied.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>