[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOFY-A2ixQ3zzmnbcp0tkLoDspSMkenB_bkGJhek+bVT0tENWw@mail.gmail.com>
Date: Sat, 13 Feb 2021 09:21:36 -0800
From: Arjun Roy <arjunroy@...gle.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Wei Wang <weiwan@...gle.com>,
Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 2/2] tcp: factorize logic into tcp_epollin_ready()
On Sat, Feb 13, 2021 at 9:10 AM Arjun Roy <arjunroy@...gle.com> wrote:
>
> On Sat, Feb 13, 2021 at 12:05 AM Eric Dumazet <edumazet@...gle.com> wrote:
> >
> > On Sat, Feb 13, 2021 at 8:50 AM Eric Dumazet <edumazet@...gle.com> wrote:
> > >
> > > On Sat, Feb 13, 2021 at 1:30 AM Wei Wang <weiwan@...gle.com> wrote:
> > > >
> > >
> > > > > void tcp_data_ready(struct sock *sk)
> > > > > {
> > > > > - const struct tcp_sock *tp = tcp_sk(sk);
> > > > > - int avail = tp->rcv_nxt - tp->copied_seq;
> > > > > -
> > > > > - if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) &&
> > > > > - !sock_flag(sk, SOCK_DONE) &&
> > > >
> > > > Seems "!sock_flag(sk, SOCK_DONE)" is not checked in
> > > > tcp_epollin_read(). Does it matter?
> > > >
> > >
> > >
> > > Yes, probably, good catch.
> > >
> > > Not sure where tcp_poll() gets this, I have to double check.
> >
> > It gets the info from sk->sk_hutdown & RCV_SHUTDOWN
> >
> > tcp_find() sets both sk->sk_shutdown |= RCV_SHUTDOWN and
> > sock_set_flag(sk, SOCK_DONE);
> >
> > This seems to suggest tcp_fin() could call sk->sk_data_ready() so that
> > we do not have to test for this unlikely condition in tcp_data_ready()
>
> When a thread is subsequently then woken up due to sk_data_ready(),
> and it calls tcp_stream_is_readable() but we had lowat > 1 set, is
> there a chance of that thread then thinking that the stream is not
> readable, despite SOCK_DONE being set? This is assuming that the check
> is not added to the refactored logic.
>
> Note that on a related note if the tcp memory pressure check (for
> system-wide pressure) is added just to the original code in
> tcp_data_ready() but not added to tcp_stream_is_readable() we had this
> kind of issue (sk_data_ready() was called but tcp_stream_is_readable()
> returned false).
>
Disregard, I just saw your followup patch. So I guess it's fine.
-Arjun
Powered by blists - more mailing lists