Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb] Check for sched_getaffinity in configure
Date: Tue, 29 Sep 2026 12:01:05 +0100	[thread overview]
Message-ID: <87tsn8z5hq.fsf@redhat.com> (raw)
In-Reply-To: <20260917124042.3215076-1-tdevries@suse.de>

Tom de Vries <tdevries@suse.de> writes:

> A post-commit review comment [1] on commit 8ea833b7067 ("[gdb] Exclude
> unavailable hardware threads in default worker-threads") mentioned that we
> should:
> - check for the presence of sched_getaffinity in configure
> - remove the todo comment.
>
> Implement these two.

Makes sense to me.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

>
> [1] https://sourceware.org/pipermail/gdb-patches/2026-September/230415.html
> ---
>  gdb/config.in    | 3 +++
>  gdb/configure    | 1 +
>  gdb/configure.ac | 1 +
>  gdb/maint.c      | 6 ++----
>  4 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/config.in b/gdb/config.in
> index 74745665d4d..0e5a6637c2b 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -430,6 +430,9 @@
>  /* Define to 1 if you have the `sbrk' function. */
>  #undef HAVE_SBRK
>  
> +/* Define to 1 if you have the `sched_getaffinity' function. */
> +#undef HAVE_SCHED_GETAFFINITY
> +
>  /* Define to 1 if you have the `setlocale' function. */
>  #undef HAVE_SETLOCALE
>  
> diff --git a/gdb/configure b/gdb/configure
> index f411113ea66..810e9ed7a37 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -30161,6 +30161,7 @@ for ac_func in  \
>    pread64 \
>    pwrite \
>    resize_term \
> +  sched_getaffinity \
>    setlocale \
>    setrlimit \
>    setsid \
> diff --git a/gdb/configure.ac b/gdb/configure.ac
> index 5d8e2d6628f..0d88a280b16 100644
> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -1542,6 +1542,7 @@ AC_CHECK_FUNCS([ \
>    pread64 \
>    pwrite \
>    resize_term \
> +  sched_getaffinity \
>    setlocale \
>    setrlimit \
>    setsid \
> diff --git a/gdb/maint.c b/gdb/maint.c
> index 800cf7e0cda..ed57b34eab5 100644
> --- a/gdb/maint.c
> +++ b/gdb/maint.c
> @@ -47,7 +47,7 @@
>  #include "cli/cli-style.h"
>  #include "cli/cli-cmds.h"
>  
> -#if defined (__linux__) || defined (__CYGWIN__)
> +#if HAVE_SCHED_GETAFFINITY
>  #include <sched.h>
>  #endif
>  
> @@ -891,13 +891,11 @@ update_thread_pool_size ()
>  	{
>  	  /* Exclude unavailable hardware threads (for instance made
>  	     unavailable using taskset).  */
> -#if (defined (__linux__) || defined (__CYGWIN__)) && defined (_GNU_SOURCE)
> +#if HAVE_SCHED_GETAFFINITY
>  	  cpu_set_t cpus;
>  	  int res = sched_getaffinity (getpid (), sizeof (cpu_set_t), &cpus);
>  	  if (res == 0)
>  	    n_threads = std::min (n_threads, CPU_COUNT (&cpus));
> -#else
> -	  /* Todo: handle other platforms.  */
>  #endif
>  	}
>      }
>
> base-commit: 4c733e49e3da1eab7991ab64c5bb75c7a56bf48a
> -- 
> 2.51.0


      reply	other threads:[~2026-09-29 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 12:40 Tom de Vries
2026-09-29 11:01 ` Andrew Burgess [this message]

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=87tsn8z5hq.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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