[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXJAmxstm21n50hjim3hLHrt0eKOGit2nfBfhgU-DvnyL7caQ@mail.gmail.com>
Date: Thu, 9 Jan 2025 10:35:56 -0800
From: John Ousterhout <ouster@...stanford.edu>
To: "D. Wythe" <alibuda@...ux.alibaba.com>
Cc: netdev@...r.kernel.org, pabeni@...hat.com, edumazet@...gle.com,
horms@...nel.org, kuba@...nel.org
Subject: Re: [PATCH net-next v5 07/12] net: homa: create homa_sock.h and homa_sock.c
On Wed, Jan 8, 2025 at 6:56 AM D. Wythe <alibuda@...ux.alibaba.com> wrote:
>
> > +int homa_sock_init(struct homa_sock *hsk, struct homa *homa)
> > +{
> > + struct homa_socktab *socktab = homa->port_map;
> > + int result = 0;
> > + int i;
> > +
> > + spin_lock_bh(&socktab->write_lock);
> > + atomic_set(&hsk->protect_count, 0);
> > + spin_lock_init(&hsk->lock);
> > + hsk->last_locker = "none";
> > + atomic_set(&hsk->protect_count, 0);
> > + hsk->homa = homa;
> > + hsk->ip_header_length = (hsk->inet.sk.sk_family == AF_INET)
> > + ? HOMA_IPV4_HEADER_LENGTH : HOMA_IPV6_HEADER_LENGTH;
> > + hsk->shutdown = false;
> > + while (1) {
> > + if (homa->next_client_port < HOMA_MIN_DEFAULT_PORT)
> > + homa->next_client_port = HOMA_MIN_DEFAULT_PORT;
> > + if (!homa_sock_find(socktab, homa->next_client_port))
> > + break;
> > + homa->next_client_port++;
>
> It seems there might be a possibility of an infinite loop if all the
> ports are in use.
Oops, you're right. I have fixed this to detect "all ports in use".
> > + hsk->buffer_pool = kzalloc(sizeof(*hsk->buffer_pool), GFP_KERNEL);
>
> using GFP_ATOMIC. I noticed that Homa frequently uses GFP_KERNEL with BH disabled.
> Please fix it all.
Done. Thanks for the comments.
-John-
Powered by blists - more mailing lists