From: Zhaoyang Huang <redacted>
The parameter allocation here is used for indicating if the memory
allocation can stall or not. Since we have got the skb buffer, it
doesn't make sense to check if we can yield on the net's congested
via gfp_flags. Remove it now.
Signed-off-by: Zhaoyang Huang <redacted>
---
net/netlink/af_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-12-23 17:11:06
On Thu, 23 Dec 2021 09:56:07 +0800 Huangzhaoyang wrote:
From: Zhaoyang Huang <redacted>
The parameter allocation here is used for indicating if the memory
allocation can stall or not. Since we have got the skb buffer, it
doesn't make sense to check if we can yield on the net's congested
via gfp_flags. Remove it now.
This is checking if we can sleep AFAICT. What are you trying to fix?
On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski [off-list ref] wrote:
On Thu, 23 Dec 2021 09:56:07 +0800 Huangzhaoyang wrote:
quoted
From: Zhaoyang Huang <redacted>
The parameter allocation here is used for indicating if the memory
allocation can stall or not. Since we have got the skb buffer, it
doesn't make sense to check if we can yield on the net's congested
via gfp_flags. Remove it now.
This is checking if we can sleep AFAICT. What are you trying to fix?
Yes and NO. gfp means *get free pages* which indicate if the embedded
memory allocation among the process can sleep or not, but without any
other meanings. The driver which invokes this function could have to
use GFP_KERNEL for allocating memory as the critical resources but
don't want to sleep on the netlink's congestion.
On Mon, Dec 27, 2021 at 2:14 PM Zhaoyang Huang [off-list ref] wrote:
On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski [off-list ref] wrote:
quoted
On Thu, 23 Dec 2021 09:56:07 +0800 Huangzhaoyang wrote:
quoted
From: Zhaoyang Huang <redacted>
The parameter allocation here is used for indicating if the memory
allocation can stall or not. Since we have got the skb buffer, it
doesn't make sense to check if we can yield on the net's congested
via gfp_flags. Remove it now.
This is checking if we can sleep AFAICT. What are you trying to fix?
Yes and NO. gfp means *get free pages* which indicate if the embedded
memory allocation among the process can sleep or not, but without any
other meanings. The driver which invokes this function could have to
use GFP_KERNEL for allocating memory as the critical resources but
don't want to sleep on the netlink's congestion.
Since unique block flags(msg_flags & MSG_DONTWAIT) work as parameters
for unicast, could we introduce it to broadcast, instead of abusing
gfp_flag.
static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
{
...
if (dst_group) {
refcount_inc(&skb->users);
netlink_broadcast(sk, skb, dst_portid, dst_group, GFP_KERNEL);
}
err = netlink_unicast(sk, skb, dst_portid, msg->msg_flags &
MSG_DONTWAIT);
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-12-28 02:02:25
On Mon, 27 Dec 2021 15:38:31 +0800 Zhaoyang Huang wrote:
On Mon, Dec 27, 2021 at 2:14 PM Zhaoyang Huang [off-list ref] wrote:
quoted
On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski [off-list ref] wrote:
quoted
This is checking if we can sleep AFAICT. What are you trying to fix?
Yes and NO. gfp means *get free pages* which indicate if the embedded
memory allocation among the process can sleep or not, but without any
other meanings. The driver which invokes this function could have to
use GFP_KERNEL for allocating memory as the critical resources but
don't want to sleep on the netlink's congestion.
Let's focus on explaining the problem you're trying to solve.
What's the driver you're talking about? Why does it have to
pay attention to the innards of netlink? Details, please.
Since unique block flags(msg_flags & MSG_DONTWAIT) work as parameters
for unicast, could we introduce it to broadcast, instead of abusing
gfp_flag.
static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
{
...
if (dst_group) {
refcount_inc(&skb->users);
netlink_broadcast(sk, skb, dst_portid, dst_group, GFP_KERNEL);
}
err = netlink_unicast(sk, skb, dst_portid, msg->msg_flags & MSG_DONTWAIT);