From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id F2D3922D46 for ; Thu, 25 Jul 2019 02:15:03 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HeSIGNxfHYIV for ; Thu, 25 Jul 2019 02:15:03 -0400 (EDT) Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 36C3C22D2C for ; Thu, 25 Jul 2019 02:15:03 -0400 (EDT) From: =?utf-8?B?0JPQtdC+0YDQs9C40Lkg0JrQuNGA0LjRh9C10L3QutC+?= Subject: [tarantool-patches] Re: [PATCH] Output of fiber.info will contain only non-idle fibers Date: Thu, 25 Jul 2019 09:14:56 +0300 Message-ID: <2274932.tPdvVCckH0@home.lan> In-Reply-To: <20190723195643.GA18567@atlas> References: <20190723195643.GA18567@atlas> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart18650446.3qnXuLUmXm"; micalg="pgp-sha256"; protocol="application/pgp-signature" Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Konstantin Osipov Cc: tarantool-patches@freelists.org --nextPart18650446.3qnXuLUmXm Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Tuesday, July 23, 2019 10:56:43 PM MSK Konstantin Osipov wrote: > * Maria K [19/07/23 21:01]: > > The output used to be too cluttered due to idle ones. > > > > Closes #4235 > > @kyukhin, first, please I don't get how does this get scheduled to a > milestone? How does this follow triage guidelines? > > Please don't schedule anything that is not a priority, even if > it's a noob issue, since it takes time of everyone involved. I think anybody is free to send a patch to the public tarantool mailing list despite the issue milestone (if they is not bound by employee duties). Also it was a 'good first issue' ticket to start a candidate on boarding. > > fiber.info() already doesn't show anything from cord->dead list. > Fibers which are stuck in a pool are performing application-level > code, even if it's a built in pool, so contribute valuable > information to fiber.info() output. Besides, it's always easy to > filter out any class of fibers with luafun. It is not easy to filter out such fibers. In the other hand tx fiber pool is 'a hack' to spare some fiber structures between invocations. So fiber pool cached fibers could/should be threatened as dead ones. > > Finally, there are other types of pools -- an application-level pool > in Lua will have lots of idle fibers in it. An application level fiber pool uses some user-defined condition with exactly- defied meaning and state. And it isn't the same as the tx fiber pool. An appplication fiber (in pool or not) is the resource managed by user while tx fiber pool is not. And I see no point in seeing an idle fiber from tx fiber pool. > > In other words, this is an partial fix of a raw feature > request. > > Tarantool instrumentation sucks, but it doesn't mean it should be > patched by quick hacks here and there. > > A nice and general solution would be to compress mostly identical > fiber.info() entries. But I guess it's not a noob task. I didn't find your suggestion solution nice and general in case of filtering idle fibers out. > > > --- > > > > src/lib/core/fiber.c | 3 ++- > > src/lib/core/fiber.h | 10 ++++++++++ > > src/lib/core/fiber_pool.c | 2 ++ > > 3 files changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c > > index ce90f930c..b1d7a5be2 100644 > > --- a/src/lib/core/fiber.c > > +++ b/src/lib/core/fiber.c > > @@ -1411,7 +1411,8 @@ int fiber_stat(fiber_stat_cb cb, void *cb_ctx) > > > > struct cord *cord = cord(); > > int res; > > rlist_foreach_entry(fiber, &cord->alive, link) { > > > > - res = cb(fiber, cb_ctx); > > + if (!fiber_is_idle(fiber)) > > + res = cb(fiber, cb_ctx); > > > > if (res != 0) > > return res; > > } > > > > diff --git a/src/lib/core/fiber.h b/src/lib/core/fiber.h > > index fb168e25e..d05132a8d 100644 > > --- a/src/lib/core/fiber.h > > +++ b/src/lib/core/fiber.h > > @@ -97,6 +97,10 @@ enum { > > > > * This flag is set when fiber uses custom stack size. > > */ > > FIBER_CUSTOM_STACK = 1 << 5, > > > > + /* > > + * > > + */ > > + FIBER_IS_IDLE = 1 << 6, > > > > FIBER_DEFAULT_FLAGS = FIBER_IS_CANCELLABLE > > > > }; > > > > @@ -620,6 +624,12 @@ fiber_is_dead(struct fiber *f) > > > > return f->flags & FIBER_IS_DEAD; > > > > } > > > > +static inline bool > > +fiber_is_idle(struct fiber *f) > > +{ > > + return f->flags & FIBER_IS_IDLE; > > +} > > + > > > > typedef int (*fiber_stat_cb)(struct fiber *f, void *ctx); > > > > int > > > > diff --git a/src/lib/core/fiber_pool.c b/src/lib/core/fiber_pool.c > > index 77f89c9fa..c04141e63 100644 > > --- a/src/lib/core/fiber_pool.c > > +++ b/src/lib/core/fiber_pool.c > > > > @@ -72,8 +72,10 @@ restart: > > * Add the fiber to the front of the list, so that > > * it is most likely to get scheduled again. > > */ > > > > + f->flags |= FIBER_IS_IDLE; > > > > rlist_add_entry(&pool->idle, fiber(), state); > > fiber_yield(); > > > > + f->flags &= ~FIBER_IS_IDLE; > > > > goto restart; > > } > > pool->size--; --nextPart18650446.3qnXuLUmXm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEFB+nbqWGnp59Rk9ZFSyY70x8X3sFAl05SOAACgkQFSyY70x8 X3t24wf9F2INFXLpAMmpui4/EDTI0+hdiL1rARGrAlxgxc6sU97EhA8axvXS/zfY QnTPJhfdTli8KsRddl43rARMWub9JgHUu+XSxzkZcGZoKprUq6wC9muFZwJRgVKD uZ7E0ccgdzW6vtY/zN1kr4hB1ciKhi50fRsjvuppdYBFK4NcIxDgkNqzgmt0aqvb Db6qMcXbxuxHairtjKTSToQeHYwFmQnVWIZmK+T19LjEY31PIec0DIqoa1OD0aYq UGEP5Vya/5ySafD5QBnC/OC9AsKqyAlAPVLp9Nmht0F/H3Y0ym9lXmFX8vQ7Wqv4 b/bjzaFQ4f7sdqoO3p7Avx6NRpkqrQ== =oT/s -----END PGP SIGNATURE----- --nextPart18650446.3qnXuLUmXm--