From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117973 invoked by alias); 17 Apr 2019 07:57:18 -0000 Mailing-List: contact cygwin-developers-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com Received: (qmail 117962 invoked by uid 89); 17 Apr 2019 07:57:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-104.8 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.126.134) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Apr 2019 07:57:17 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M4bd0-1hF1153w98-001glM for ; Wed, 17 Apr 2019 09:57:14 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id C432AA80751; Wed, 17 Apr 2019 09:57:12 +0200 (CEST) Date: Wed, 17 Apr 2019 07:57:00 -0000 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: Implement sched_[gs]etaffinity() Message-ID: <20190417075712.GX3599@calimero.vinschen.de> Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <20190411082516.GN4248@calimero.vinschen.de> <20190411083745.GO4248@calimero.vinschen.de> <20190412074533.GT4248@calimero.vinschen.de> <20190416104512.GO3599@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Pz/qqzCPDfGwIFOg" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-04/txt/msg00051.txt.bz2 --Pz/qqzCPDfGwIFOg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2327 On Apr 16 21:31, Mark Geisert wrote: > On Tue, 16 Apr 2019, Corinna Vinschen wrote: > > On Apr 16 01:19, Mark Geisert wrote: > > > Anybody know if one can > > > depend on the group membership of the first processor group to apply = to all > > > groups? > >=20 > > Maybe https://go.microsoft.com/fwlink/p/?linkid=3D147914 helps? > >=20 > > "If the number of logical processors exceeds the maximum group size, > > Windows creates multiple groups by splitting the node into n groups, > > where the first n-1 groups have capacities that are equal to the group > > size." >=20 > Great; thanks for that. >=20 > > [...] > > Therefore: > >=20 > > WORD cpu_group =3D cpu_number / num_cpu_per_group; > > KAFFINITY cpu_mask =3D 1L << (cpu_number % num_cpu_per_group); > >=20 > > That also means the transposition between the groupless linux system > > and the WIndows system is fairly easy. >=20 > Yes, dealing with an array of unsigned longs vs bitblt ops FTW. >=20 > > > (6) On Linux, processor affinity is inherited across fork() and execv= e(). > > > I'll need to ensure Cygwin's implementation of those calls handle aff= inity > > > the same way. > >=20 > > Just passing the INHERIT_PARENT_AFFINITY flag to CreateProcess{AsUser} > > should do the trick. >=20 > OK. Hope so. Well, nope, sorry. Per MSDN: The process inherits its parent's affinity. If the parent process has threads in more than one processor group, the new process inherits the group-relative affinity of an arbitrary group in use by the parent. Also important: This value is not supported on Vista, so it should only be used if wincap.has_processor_groups() is true. > (7), to make a prime number: I don't see any need for the Cygwin DLL to k= eep > any affinity info (process or thread) or processor group membership info > around, do you? I believe the sched_get/setaffinity functions will do > whatever Windows ops they need to do on the fly based on the args passed = in. > That allows the user to do Windows affinity ops at will outside of Cygwin > without screwing up any Cygwin-maintained context. I agree. Additionally I think we should not overvalue affinity inheritance. Specifying INHERIT_PARENT_AFFINITY should be enough for a start. There's no reason for overkill. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --Pz/qqzCPDfGwIFOg Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAly23FgACgkQ9TYGna5E T6AX9w/+N34WPRjzVAeRMfncxEY43KzZW4+Q1aEg2ckfzBywGH6+khnP4hT4BLc3 oVvcS2ejqoM5qLGCYjGfkL8lPwZB80Z4ZwQsjo4msl6riGnECNnKdQ3gRgV+i8Cl Ehl+pRXmMhrAxmXQ9ru8n4w8+YJFMnlGhQGTOkDdA16zGZ1ygqhYdrnK5B/blrxL UcluVt0vza6Qx7p644lEbGzwg/KW1FwgZNmuVesKjZZ/HzF0SXjwNS+C07yzoTKQ s0OjR/ZgNrkaa20HazEl1ooASVKZKuCT9//BsPio06EpPdAaodaTbgquy6XP+w1y LsL7zJese4oIsV/Y6eMFyMZThqGu9mPRuCQbi5cZM2djthAHo5PBtryACDH78Dwe YNyjP6Kkv76RTNI3xHmpCI7iPxEXIX5sYl+jsQEOZUTdUTqRuqFF70nl8BvnL7fm oIT23fOaPZ3aRaqAGbSAdH1Lhi0DrJWgRLbUz1yHNHY4ogBB4joFJEfhgkDqheOF TJOP0ojm2asKqFJ7mPQzJdv41AQMP5im4B6wo7J8h1QP0ZxyPog1H9/LPpGFUOAC gC109kD9ptWbjBJNjXBtbBatIMp5MDFPxu6I8RNeh8AJg5NHfXozmI9rNQ/DosXt dHN7eUzuDggsbtrLuw+PJoKtSU9CqgXBZDwjyZZ1b9ddiDS397c= =7wsj -----END PGP SIGNATURE----- --Pz/qqzCPDfGwIFOg--