[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGWkznEOsLweqA3omJ+xMs4bWvyphSvKBQmqPs+rer_e5fqKHg@mail.gmail.com>
Date: Mon, 27 Dec 2021 15:38:31 +0800
From: Zhaoyang Huang <huangzhaoyang@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Zhaoyang Huang <zhaoyang.huang@...soc.com>,
netdev@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: remove judgement based on gfp_flags
On Mon, Dec 27, 2021 at 2:14 PM Zhaoyang Huang <huangzhaoyang@...il.com> wrote:
>
> On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski <kuba@...nel.org> wrote:
> >
> > On Thu, 23 Dec 2021 09:56:07 +0800 Huangzhaoyang wrote:
> > > From: Zhaoyang Huang <zhaoyang.huang@...soc.com>
> > >
> > > 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);
>
> >
> > > diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> > > index 4c57532..af5b6af 100644
> > > --- a/net/netlink/af_netlink.c
> > > +++ b/net/netlink/af_netlink.c
> > > @@ -1526,7 +1526,7 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 portid,
> > > consume_skb(info.skb2);
> > >
> > > if (info.delivered) {
> > > - if (info.congested && gfpflags_allow_blocking(allocation))
> > > + if (info.congested)
> > > yield();
> > > return 0;
> > > }
> >
Powered by blists - more mailing lists