util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Thijs Raymakers <thijs@raymakers.nl>
Cc: kzak@redhat.com, util-linux@vger.kernel.org,
	 Phil Auld <pauld@redhat.com>
Subject: Re: [PATCH v9] coresched: Manage core scheduling cookies for tasks
Date: Tue, 23 Apr 2024 12:19:37 +0200	[thread overview]
Message-ID: <df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de> (raw)
In-Reply-To: <20240417113932.14237-1-thijs@raymakers.nl>

On 2024-04-17 13:39:32+0000, Thijs Raymakers wrote:
> Co-authored-by: Phil Auld <pauld@redhat.com>
> Signed-off-by: Phil Auld <pauld@redhat.com>
> Signed-off-by: Thijs Raymakers <thijs@raymakers.nl>
> ---
> 
> Hi Karel,
> 
> Thanks for taking a look at it! Here is the version that addresses the
> man page comments that Phil made.
> 
> Thijs

[..]

> diff --git a/schedutils/coresched.c b/schedutils/coresched.c
> new file mode 100644
> index 000000000..bb97cc020
> --- /dev/null
> +++ b/schedutils/coresched.c
> @@ -0,0 +1,358 @@
> +/**
> + * SPDX-License-Identifier: EUPL-1.2
> + *
> + * coresched.c - manage core scheduling cookies for tasks
> + *
> + * Copyright (C) 2024 Thijs Raymakers, Phil Auld
> + * Licensed under the EUPL v1.2
> + */
> +
> +#include <getopt.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <sys/prctl.h>
> +#include <unistd.h>
> +
> +#include "c.h"
> +#include "closestream.h"
> +#include "nls.h"
> +#include "strutils.h"
> +
> +// These definitions might not be defined in the header files, even if the
> +// prctl interface in the kernel accepts them as valid.
> +#ifndef PR_SCHED_CORE
> +	#define PR_SCHED_CORE 62
> +#endif
> +#ifndef PR_SCHED_CORE_GET
> +	#define PR_SCHED_CORE_GET 0
> +#endif
> +#ifndef PR_SCHED_CORE_CREATE
> +	#define PR_SCHED_CORE_CREATE 1
> +#endif
> +#ifndef PR_SCHED_CORE_SHARE_TO
> +	#define PR_SCHED_CORE_SHARE_TO 2
> +#endif
> +#ifndef PR_SCHED_CORE_SHARE_FROM
> +	#define PR_SCHED_CORE_SHARE_FROM 3
> +#endif
> +#ifndef PR_SCHED_CORE_SCOPE_THREAD
> +	#define PR_SCHED_CORE_SCOPE_THREAD 0
> +#endif
> +#ifndef PR_SCHED_CORE_SCOPE_THREAD_GROUP
> +	#define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1
> +#endif
> +#ifndef PR_SCHED_CORE_SCOPE_PROCESS_GROUP
> +	#define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2
> +#endif
> +
> +typedef int sched_core_scope;
> +typedef unsigned long sched_core_cookie;

This should be uint64_t, as the kernel will always copy 64 bytes.

Otherwise it will smash the stack on 32bit:

https://download.copr.fedorainfracloud.org/results/packit/util-linux-util-linux-2990/fedora-rawhide-i386/07339240-util-linux/builder-live.log.gz

> +typedef enum {
> +	SCHED_CORE_CMD_GET,
> +	SCHED_CORE_CMD_NEW,
> +	SCHED_CORE_CMD_COPY,
> +} sched_core_cmd;
> +
> +struct args {
> +	pid_t src;
> +	pid_t dest;
> +	sched_core_scope type;
> +	sched_core_cmd cmd;
> +	int exec_argv_offset;
> +};
> +

[..]

  parent reply	other threads:[~2024-04-23 10:19 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16 17:10 [PATCH RFC] coresched: Manage core scheduling cookies for tasks Thijs Raymakers
2024-03-24 20:07 ` Karel Zak
2024-03-26 14:41   ` Phil Auld
2024-03-26 14:45     ` Phil Auld
2024-03-26 17:49     ` [PATCH 0/1] " Thijs Raymakers
2024-03-26 18:13       ` Phil Auld
2024-03-27 12:43         ` [PATCH v2 " Thijs Raymakers
2024-03-27 13:21           ` Phil Auld
2024-03-27 14:18             ` Phil Auld
2024-03-27 15:30               ` [PATCH v3] " Thijs Raymakers
2024-04-01 17:18                 ` Thomas Weißschuh
2024-04-04 22:03                   ` [PATCH v4] " Thijs Raymakers
2024-04-05  6:26                     ` Thomas Weißschuh
2024-04-05 14:14                       ` Phil Auld
2024-04-08 21:16                         ` [PATCH v5] " Thijs Raymakers
2024-04-09  6:12                           ` Thomas Weißschuh
2024-04-09 11:55                             ` [PATCH v6] " Thijs Raymakers
2024-04-09 13:44                               ` Karel Zak
2024-04-09 14:12                                 ` Phil Auld
2024-04-10 21:11                                 ` [PATCH v7] " Thijs Raymakers
2024-04-10 22:15                                   ` Phil Auld
2024-04-11 11:02                                     ` [PATCH v8] " Thijs Raymakers
2024-04-11 13:46                                       ` Phil Auld
2024-04-17 10:31                                         ` Karel Zak
2024-04-17 11:39                                           ` [PATCH v9] " Thijs Raymakers
2024-04-23  9:27                                             ` Karel Zak
2024-04-23 10:19                                             ` Thomas Weißschuh [this message]
2024-04-23 11:12                                               ` [PATCH v10] " Thijs Raymakers
2024-04-25 15:36                                                 ` [PATCH v11] " Thijs Raymakers
2024-04-25 15:51                                                   ` Thomas Weißschuh
2024-04-25 16:22                                                     ` [PATCH v12] " Thijs Raymakers
2024-04-26  7:59                                                       ` Karel Zak
2024-04-26 18:03                                                       ` Thomas Weißschuh
2024-04-29  8:28                                                         ` Karel Zak
2024-04-17 12:27                                           ` [PATCH v8] " Phil Auld
2024-03-27 12:43         ` [PATCH v2 1/1] " Thijs Raymakers
2024-03-27 14:09           ` Phil Auld
2024-03-26 19:09       ` [PATCH 0/1] " Phil Auld
2024-03-26 19:26         ` Thijs Raymakers
2024-03-26 20:16           ` Phil Auld
2024-03-26 20:17             ` Phil Auld
2024-03-26 17:49     ` [PATCH 1/1] " Thijs Raymakers

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=df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=kzak@redhat.com \
    --cc=pauld@redhat.com \
    --cc=thijs@raymakers.nl \
    --cc=util-linux@vger.kernel.org \
    /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).