Re: [PATCH] net: remove judgement based on gfp_flags

From: Jakub Kicinski
Date: Mon Dec 27 2021 - 21:02:43 EST


On Mon, 27 Dec 2021 15:38:31 +0800 Zhaoyang Huang wrote:
> On Mon, Dec 27, 2021 at 2:14 PM Zhaoyang Huang <huangzhaoyang@xxxxxxxxx> wrote:
> > On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> > > 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);