[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADvbK_dMjcw6LKsSQogb65i_9VHNKdrc_YTcJ3osYQ=aEytQWw@mail.gmail.com>
Date: Tue, 8 Mar 2016 10:54:52 +0800
From: Xin Long <lucien.xin@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: network dev <netdev@...r.kernel.org>, linux-sctp@...r.kernel.org,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Vlad Yasevich <vyasevich@...il.com>, daniel@...earbox.net,
davem <davem@...emloft.net>
Subject: Re: [PATCH net] sctp: use gfp insteaad of GFP_NOWAIT in
idr_alloc_cyclic when sctp_assoc_set_id
On Mon, Mar 7, 2016 at 7:21 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> What is the problem of being not able to allocate memory at this point ?
>
Now I think about it again, this patch cannot work, because of:
__sctp_connect()
sctp_assoc_set_id(asoc, GFP_KERNEL)
thanks, Eric
> If really it bothers you (although we have thousands of other places it
> can happen), maybe add __GFP_NOWARN
>
> But whatever flag we use here, idr_alloc() _can_ fail.
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 2bf8ec92dde4..2ae3874e3696 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -1606,7 +1606,8 @@ int sctp_assoc_set_id(struct sctp_association *asoc, gfp_t gfp)
> idr_preload(gfp);
> spin_lock_bh(&sctp_assocs_id_lock);
> /* 0 is not a valid assoc_id, must be >= 1 */
> - ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0, GFP_NOWAIT);
> + ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0,
> + (gfp & ~__GFP_DIRECT_RECLAIM) | __GFP_NOWARN);
> spin_unlock_bh(&sctp_assocs_id_lock);
> if (preload)
> idr_preload_end();
>
>
Powered by blists - more mailing lists