From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: remove judgement based on gfp_flags
Date: Mon, 27 Dec 2021 15:38:31 +0800 [thread overview]
Message-ID: <CAGWkznEOsLweqA3omJ+xMs4bWvyphSvKBQmqPs+rer_e5fqKHg@mail.gmail.com> (raw)
In-Reply-To: <CAGWkznHcjrM2kth8uWtuu+H-LOdPGXAN70nBYJax7aqcuHkECg@mail.gmail.com>
On Mon, Dec 27, 2021 at 2:14 PM Zhaoyang Huang <huangzhaoyang@gmail.com> wrote:
>
> On Fri, Dec 24, 2021 at 1:11 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Thu, 23 Dec 2021 09:56:07 +0800 Huangzhaoyang wrote:
> > > From: Zhaoyang Huang <zhaoyang.huang@unisoc.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;
> > > }
> >
next prev parent reply other threads:[~2021-12-27 7:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 1:56 [PATCH] net: remove judgement based on gfp_flags Huangzhaoyang
2021-12-23 17:11 ` Jakub Kicinski
2021-12-27 6:14 ` Zhaoyang Huang
2021-12-27 7:38 ` Zhaoyang Huang [this message]
2021-12-28 2:02 ` Jakub Kicinski
2022-01-04 2:57 ` [net] 6f87debdea: BUG:scheduling_while_atomic kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGWkznEOsLweqA3omJ+xMs4bWvyphSvKBQmqPs+rer_e5fqKHg@mail.gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=zhaoyang.huang@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).