New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg/async: increase worker reference with local listen table enabled backend #15897

Merged
merged 1 commit into from Jul 5, 2017

Conversation

Projects
None yet
2 participants
@yuyuyu101
Member

yuyuyu101 commented Jun 24, 2017

Signed-off-by: Haomai Wang haomai@xsky.com

@@ -171,13 +171,16 @@ void Processor::accept()
Worker *w = worker;
if (!msgr->get_stack()->support_local_listen_table())
w = msgr->get_stack()->get_worker();
else
++w->references;
int r = listen_socket.accept(&cli_socket, opts, &addr, w);

This comment has been minimized.

@tchaikov

tchaikov Jun 26, 2017

Contributor

is w used/held anywhere by the listen_socket.accept()? and how is the reference count decremented by, for example, PosixServerSocketImpl?

This comment has been minimized.

@yuyuyu101

yuyuyu101 Jun 26, 2017

Member

yes, worker should be existed always

This comment has been minimized.

@yuyuyu101

yuyuyu101 Jun 26, 2017

Member

the reference doesn't mean the lifecycle of Worker, it's just a hit about connection aggresive

int r = listen_socket.accept(&cli_socket, opts, &addr, w);
if (r == 0) {
ldout(msgr->cct, 10) << __func__ << " accepted incoming on sd " << cli_socket.fd() << dendl;
msgr->add_accept(w, std::move(cli_socket), addr);
continue;
} else {
--w->references;

This comment has been minimized.

@tchaikov

tchaikov Jun 26, 2017

Contributor

can we use release_worker() instead?

@@ -171,13 +171,16 @@ void Processor::accept()
Worker *w = worker;
if (!msgr->get_stack()->support_local_listen_table())
w = msgr->get_stack()->get_worker();
else

This comment has been minimized.

@tchaikov

tchaikov Jun 26, 2017

Contributor

can we put

if (msgr->get_stack()->support_local_listen_table()) {
  w = worker;
  w->reference++;
} else {
  w = msgr->get_stack()->get_worker();
}
  1. use positive logic to help with the readablity
  2. more explicit on what the w is assigned
  3. post-increment is faster for atmic<> types
@tchaikov

This comment has been minimized.

Contributor

tchaikov commented Jun 30, 2017

retest this please.

if (!msgr->get_stack()->support_local_listen_table())
if (msgr->get_stack()->support_local_listen_table()) {
w = worker;
w->reference++;

This comment has been minimized.

@tchaikov

tchaikov Jun 30, 2017

Contributor
/home/jenkins-build/build/workspace/ceph-pull-requests/src/msg/async/AsyncMessenger.cc: In member function ‘void Processor::accept()’:
/home/jenkins-build/build/workspace/ceph-pull-requests/src/msg/async/AsyncMessenger.cc:174:10: error: ‘class Worker’ has no member named ‘reference’
       w->reference++;

s/reference/references/

This comment has been minimized.

@yuyuyu101

@tchaikov tchaikov merged commit ecc6b8c into ceph:master Jul 5, 2017

3 of 4 checks passed

default Build finished.
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment