[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXJAmxWOmPi-khSUugzOOjMSgVpWnn7QZ28jORK4sL9=vrA9A@mail.gmail.com>
Date: Wed, 29 Jan 2025 16:48:37 -0800
From: John Ousterhout <ouster@...stanford.edu>
To: Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, edumazet@...gle.com, horms@...nel.org,
kuba@...nel.org
Subject: Re: [PATCH net-next v6 08/12] net: homa: create homa_incoming.c
On Mon, Jan 27, 2025 at 2:19 AM Paolo Abeni <pabeni@...hat.com> wrote:
>
> On 1/15/25 7:59 PM, John Ousterhout wrote:
> > + /* Each iteration through the following loop processes one packet. */
> > + for (; skb; skb = next) {
> > + h = (struct homa_data_hdr *)skb->data;
> > + next = skb->next;
> > +
> > + /* Relinquish the RPC lock temporarily if it's needed
> > + * elsewhere.
> > + */
> > + if (rpc) {
> > + int flags = atomic_read(&rpc->flags);
> > +
> > + if (flags & APP_NEEDS_LOCK) {
> > + homa_rpc_unlock(rpc);
> > + homa_spin(200);
>
> Why spinning on the current CPU here? This is completely unexpected, and
> usually tolerated only to deal with H/W imposed delay while programming
> some device registers.
This is done to pass the RPC lock off to another thread (the
application); the spin is there to allow the other thread to acquire
the lock before this thread tries to acquire it again (almost
immediately). There's no performance impact from the spin because this
thread is going to turn around and try to acquire the RPC lock again
(at which point it will spin until the other thread releases the
lock). Thus it's either spin here or spin there. I've added a comment
to explain this.
-John-
Powered by blists - more mailing lists