From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Jay Vosburgh <fubar@us.ibm.com>,
Andy Gospodarek <andy@greyhouse.net>,
Eric Dumazet <edumazet@google.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Joe Perches <joe@perches.com>,
Neil Horman <nhorman@tuxdriver.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()
Date: Fri, 03 Aug 2012 11:17:08 +0200 [thread overview]
Message-ID: <1343985428.9299.868.camel@edumazet-glaptop> (raw)
In-Reply-To: <1343403484-29347-2-git-send-email-amwang@redhat.com>
On Fri, 2012-07-27 at 23:37 +0800, Cong Wang wrote:
> slave_enable_netpoll() and __netpoll_setup() may be called
> with read_lock() held, so should use GFP_ATOMIC to allocate
> memory.
>
> Cc: "David S. Miller" <davem@davemloft.net>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> ---
> drivers/net/bonding/bond_main.c | 2 +-
> net/core/netpoll.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 6fae5f3..ab773d4 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1235,7 +1235,7 @@ static inline int slave_enable_netpoll(struct slave *slave)
> struct netpoll *np;
> int err = 0;
>
> - np = kzalloc(sizeof(*np), GFP_KERNEL);
> + np = kzalloc(sizeof(*np), GFP_ATOMIC);
> err = -ENOMEM;
> if (!np)
> goto out;
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index b4c90e4..c78a966 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -734,7 +734,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
> }
>
> if (!ndev->npinfo) {
> - npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL);
> + npinfo = kmalloc(sizeof(*npinfo), GFP_ATOMIC);
> if (!npinfo) {
> err = -ENOMEM;
> goto out;
Yes this works, but maybe you instead could pass/add a gfp_t flags
argument to __netpoll_setup() ?
Management tasks should allow GFP_KERNEL allocations to have less
failure risks.
Its sad bonding uses the rwlock here instead of a mutex
next prev parent reply other threads:[~2012-08-03 9:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-27 15:37 [PATCH 0/7] netpoll and netconsole fixes for 3.6 Cong Wang
2012-07-27 15:37 ` [PATCH 1/7] netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup() Cong Wang
2012-08-03 9:17 ` Eric Dumazet [this message]
2012-08-03 9:34 ` Cong Wang
2012-08-03 10:10 ` Eric Dumazet
2012-08-06 9:08 ` Cong Wang
2012-08-06 9:44 ` Eric Dumazet
2012-08-06 12:31 ` Cong Wang
2012-07-27 15:37 ` [PATCH 2/7] netpoll: make __netpoll_cleanup non-block Cong Wang
2012-07-27 18:40 ` Neil Horman
2012-07-30 1:42 ` Cong Wang
2012-07-27 15:38 ` [PATCH 3/7] netconsole: do not release spin_lock before calling __netpoll_cleanup Cong Wang
2012-07-27 15:38 ` [PATCH 4/7] bridge: call NETDEV_RELEASE notifier in br_del_if() Cong Wang
2012-07-27 15:50 ` Stephen Hemminger
2012-07-30 1:59 ` Cong Wang
2012-07-27 15:38 ` [PATCH 5/7] netpoll: take rcu_read_lock_bh() in netpoll_rx() Cong Wang
2012-07-27 15:38 ` [PATCH 6/7] netpoll: use netpoll_rx_on() " Cong Wang
2012-07-27 15:38 ` [PATCH 7/7] netpoll: take rcu_read_lock_bh() in netpoll_send_skb_on_dev() Cong Wang
2012-08-01 2:22 ` [PATCH 0/7] netpoll and netconsole fixes for 3.6 Cong Wang
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=1343985428.9299.868.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=amwang@redhat.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fubar@us.ibm.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=xiyou.wangcong@gmail.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