From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58495 invoked by alias); 14 Dec 2018 21:08:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 58469 invoked by uid 89); 14 Dec 2018 21:08:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com From: Florian Weimer To: Carlos O'Donell Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] manual: Document lack of conformance of sched_* functions [BZ #14829] References: <87sgz9fq53.fsf@oldenburg2.str.redhat.com> <74c5309f-ca7a-ae8b-5704-86329525cfde@redhat.com> Date: Fri, 14 Dec 2018 21:09:00 -0000 In-Reply-To: <74c5309f-ca7a-ae8b-5704-86329525cfde@redhat.com> (Carlos O'Donell's message of "Fri, 14 Dec 2018 15:55:14 -0500") Message-ID: <87o99ng6kg.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-12/txt/msg00506.txt.bz2 * Carlos O'Donell: >> 2018-12-07 Florian Weimer >> >> [BZ #14829] >> * manual/resource.texi (Basic Scheduling Functions): Add >> portability note. Change process to task throughout the section. >> Remove incorrect comment about sched_yield as it affects >> tasks/threads, not entire processes. > > I think we need a *big* comment in sysdeps/unix/sysv/linux/bits/posix_opt.h > around the define of _POSIX_PRIORITY_SCHEDULING which says: > > /* On Linux we do not conform to the POSIX requirements for setting > _POSIX_PRIORITY_SCHEDULING, and it should be set to -1, but it has > been enabled for so long that we cannot risk setting it to -1 without > serious issues arising with existing applications, so we leave it enabled > even though on Linux the APIs all take thread IDs. Please see bug 14829. */ > > What do you think? I think that is a separate discussion. We could stop defining _POSIX_PRIORITY_SCHEDULING to -1, but still provide the corresponding definitions and declarations under _GNU_SOURCE. Whether that's feasible requires substantial additional research. I'm fine with adding a comment to sysdeps/unix/sysv/linux/bits/posix_opt.h along the lines you suggested, maybe: /* Priority scheduling is not supported with the correct semantics, but GNU/Linux applications expect that the corresponding interfaces are available, even though the semantics do not meet the POSIX requirements. */ #define _POSIX_PRIORITY_SCHEDULING 200809L Or we could use the text you proposed. >> diff --git a/manual/resource.texi b/manual/resource.texi >> index 8bc2a803d4..f02192475a 100644 >> --- a/manual/resource.texi >> +++ b/manual/resource.texi >> @@ -750,6 +750,14 @@ policy, if anything, only fine tunes the effect of that priority. >> >> The symbols in this section are declared by including file @file{sched.h}. >> >> +@strong{Portability Note:} In POSIX, the @code{pid_t} arguments of the >> +functions below refer to process IDs. On Linux, they are actually >> +thread IDs, and control how specific threads are scheduled with >> +regards to the entire system. The resulting behavior does not conform >> +to POSIX. This is why the following description refers to tasks and >> +tasks IDs, and not processes and process IDs. >> +@c https://sourceware.org/bugzilla/show_bug.cgi?id=14829 > > OK. > > Should we also mention that PTHREAD_SCOPE_PROCESS is entirely unsupported by > glibc on Linux? Wouldn't that be something for the documentation of pthread_attr_setscope, which does not exist yet? Thanks, Florian