linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Dawei Li <set_pte_at@outlook.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	linkinjeon@kernel.org, sfrench@samba.org, tom@talpey.com,
	hyc.lee@gmail.com, linux-cifs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] ksmbd: replace rwlock with rcu for concurrenct access on conn list
Date: Tue, 31 Jan 2023 11:39:33 +0900	[thread overview]
Message-ID: <Y9h/ZbLPQlbKiRzZ@google.com> (raw)
In-Reply-To: <TYCP286MB23230E29CC81F5C0590C59C9CAD39@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM>

Hi,

On (23/01/30 22:16), Dawei Li wrote:
> Hi Sergey,
> 
> Thanks for reviewing,
> 
> On Mon, Jan 30, 2023 at 01:15:35PM +0900, Sergey Senozhatsky wrote:
> > On (23/01/15 18:32), Dawei Li wrote:
> > > 
> > >  void ksmbd_conn_free(struct ksmbd_conn *conn)
> > >  {
> > > -	write_lock(&conn_list_lock);
> > > -	list_del(&conn->conns_list);
> > > -	write_unlock(&conn_list_lock);
> > > +	spin_lock(&conn_list_lock);
> > > +	list_del_rcu(&conn->conns_list);
> > > +	spin_unlock(&conn_list_lock);
>         synchronize_rcu(); 
> > >  
> > >  	xa_destroy(&conn->sessions);
> > >  	kvfree(conn->request_buf);
> > 
> > From a quick look this does not seem like a correct RCU usage. E.g.
> > where do you wait for grace periods and synchronize readers/writers?
> 
> Nice catch, I totally mess it up. Thanks!
> 
> At first glance, I assume synchronize_rcu() will do the job if sleeping
> is OK?

Yes, synchronize_rcu() will sleep (schedule()) and wait for grace
period to expire (and synchronize will all the RCU readers). RCU
is good for cases when writes are seldom, which may not be the case
with ksmb.

I really want to see benhcmarks, why do we want to remove the RW-lock.

  parent reply	other threads:[~2023-01-31  2:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230115103209.146002-1-set_pte_at@outlook.com>
2023-01-15 10:32 ` [PATCH 1/6] ksmbd: Implements sess->ksmbd_chann_list as xarray Dawei Li
2023-01-15 10:32 ` [PATCH 2/6] ksmbd: Implements sess->rpc_handle_list " Dawei Li
2023-01-15 10:32 ` [PATCH 3/6] ksmbd: replace rwlock with rcu for concurrenct access on conn list Dawei Li
2023-01-30  4:12   ` Sergey Senozhatsky
2023-01-30  4:15   ` Sergey Senozhatsky
2023-01-30 14:16     ` Dawei Li
2023-01-30 15:43       ` Steve French
2023-01-31  2:39       ` Sergey Senozhatsky [this message]
2023-01-15 10:32 ` [PATCH 4/6] ksmbd: Remove duplicated codes Dawei Li
2023-01-15 10:32 ` [PATCH 5/6] ksmbd: improve exception handling and avoid redundant sanity check in loop Dawei Li
2023-01-16 14:38   ` Namjae Jeon
2023-01-15 10:32 ` [PATCH 6/6] ksmbd: fix typo, syncronous->synchronous Dawei Li
2023-01-31  2:40   ` Sergey Senozhatsky

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=Y9h/ZbLPQlbKiRzZ@google.com \
    --to=senozhatsky@chromium.org \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=set_pte_at@outlook.com \
    --cc=sfrench@samba.org \
    --cc=tom@talpey.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;
as well as URLs for NNTP newsgroup(s).