From: Carlos O'Donell via Libc-alpha <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH 13/19] nptl: Use __pthread_attr_setaffinity_np in pthread_getattr_np
Date: Mon, 1 Jun 2020 23:36:22 -0400 [thread overview]
Message-ID: <2864983e-afaa-93c8-38c3-b84babc44a56@redhat.com> (raw)
In-Reply-To: <97d4eaaccdee458f469942064acb202b09a82df4.1589884403.git.fweimer@redhat.com>
On 5/19/20 6:44 AM, Florian Weimer via Libc-alpha wrote:
> This avoids duplicating the code for the affinity mask allocation
> handling.
OK for master.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> ---
> nptl/pthread_getattr_np.c | 30 ++++++++++++++----------------
> 1 file changed, 14 insertions(+), 16 deletions(-)
>
> diff --git a/nptl/pthread_getattr_np.c b/nptl/pthread_getattr_np.c
> index 0e8911346d..ce437205e4 100644
> --- a/nptl/pthread_getattr_np.c
> +++ b/nptl/pthread_getattr_np.c
> @@ -33,8 +33,13 @@ int
> __pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
> {
> struct pthread *thread = (struct pthread *) thread_id;
> +
> + /* Prepare the new thread attribute. */
> + int ret = __pthread_attr_init (attr);
> + if (ret != 0)
> + return ret;
> +
OK.
> struct pthread_attr *iattr = (struct pthread_attr *) attr;
> - int ret = 0;
>
> lll_lock (thread->lock, LLL_PRIVATE);
>
> @@ -187,25 +192,18 @@ __pthread_getattr_np (pthread_t thread_id, pthread_attr_t *attr)
> while (ret == EINVAL && size < 1024 * 1024);
>
> if (ret == 0)
> - {
> - iattr->cpuset = cpuset;
> - iattr->cpusetsize = size;
> - }
> - else
> - {
> - free (cpuset);
> - if (ret == ENOSYS)
> - {
> - /* There is no such functionality. */
> - ret = 0;
> - iattr->cpuset = NULL;
> - iattr->cpusetsize = 0;
> - }
> - }
> + ret = __pthread_attr_setaffinity_np (attr, size, cpuset);
OK. Handled all in pthread_attr_setaffinity_np.
> + else if (ret == ENOSYS)
> + /* There is no such functionality. */
> + ret = 0;
> + free (cpuset);
OK.
> }
>
> lll_unlock (thread->lock, LLL_PRIVATE);
>
> + if (ret != 0)
> + __pthread_attr_destroy (attr);
OK. Destory the attribute if things failed.
> +
> return ret;
> }
> versioned_symbol (libc, __pthread_getattr_np, pthread_getattr_np, GLIBC_2_32);
>
--
Cheers,
Carlos.
next prev parent reply other threads:[~2020-06-02 3:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 10:43 [PATCH 00/19] Signal mask for timer helper thread Florian Weimer via Libc-alpha
2020-05-19 10:44 ` [PATCH 01/19] manual: Add missing section and node for clockid_t wait functions Florian Weimer via Libc-alpha
2020-05-20 13:12 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 02/19] nptl: Replace some stubs with the Linux implementation Florian Weimer via Libc-alpha
2020-05-20 13:27 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 03/19] nptl: Move pthread_attr_setaffinity_np into libc Florian Weimer via Libc-alpha
2020-05-20 13:31 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 04/19] nptl: Move pthread_getaffinity_np " Florian Weimer via Libc-alpha
2020-05-20 13:52 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 05/19] nptl: Move pthread_gettattr_np " Florian Weimer via Libc-alpha
2020-05-20 13:57 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 06/19] nptl: Make __pthread_attr_init, __pthread_attr_destroy available internally Florian Weimer via Libc-alpha
2020-05-20 13:59 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 07/19] nptl: Add __pthread_attr_copy for copying pthread_attr_t objects Florian Weimer via Libc-alpha
2020-05-20 14:10 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 08/19] nptl: Use __pthread_attr_copy in pthread_getattr_default_np (bug 25999) Florian Weimer via Libc-alpha
2020-05-20 14:42 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 09/19] nptl: Use __pthread_attr_copy in pthread_setattr_default_np Florian Weimer via Libc-alpha
2020-05-20 14:48 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 10/19] <libc-symbols.h>: Add libpthread hidden alias support Florian Weimer via Libc-alpha
2020-05-20 14:51 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 11/19] nptl: Add internal alias __pthread_getattr_default_np Florian Weimer via Libc-alpha
2020-06-02 3:28 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 12/19] nptl: Use __pthread_getattr_default_np in pthread_create Florian Weimer via Libc-alpha
2020-06-02 3:34 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 13/19] nptl: Use __pthread_attr_setaffinity_np in pthread_getattr_np Florian Weimer via Libc-alpha
2020-06-02 3:36 ` Carlos O'Donell via Libc-alpha [this message]
2020-05-19 10:44 ` [PATCH 14/19] nptl: Change type of __default_pthread_attr Florian Weimer via Libc-alpha
2020-06-02 3:39 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 15/19] nptl: Destroy the default thread attribute as part of freeres Florian Weimer via Libc-alpha
2020-06-02 3:41 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 16/19] nptl: Make pthread_attr_t dynamically extensible Florian Weimer via Libc-alpha
2020-06-02 3:47 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:44 ` [PATCH 17/19] nptl: Add pthread_attr_setsigmask_np, pthread_attr_getsigmask_np Florian Weimer via Libc-alpha
2020-06-02 4:01 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:45 ` [PATCH 18/19] manual: " Florian Weimer via Libc-alpha
2020-05-20 7:39 ` Michael Kerrisk via Libc-alpha
2020-06-03 9:26 ` Florian Weimer via Libc-alpha
2020-06-02 4:05 ` Carlos O'Donell via Libc-alpha
2020-05-19 10:45 ` [PATCH 19/19] Linux: Use __pthread_attr_setsigmask_internal for timer helper thread Florian Weimer via Libc-alpha
2020-06-02 4:07 ` Carlos O'Donell via Libc-alpha
2020-05-20 13:11 ` [PATCH 00/19] Signal mask " Carlos O'Donell via Libc-alpha
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2864983e-afaa-93c8-38c3-b84babc44a56@redhat.com \
--to=libc-alpha@sourceware.org \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).