From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95781 invoked by alias); 7 May 2015 07:57:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 95766 invoked by uid 89); 7 May 2015 07:57:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 07 May 2015 07:57:23 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id E8801A0BA8; Thu, 7 May 2015 07:57:21 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-89.ams2.redhat.com [10.36.116.89]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t477vJdf018118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 May 2015 03:57:21 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t477vIxe023986; Thu, 7 May 2015 09:57:19 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t477vHIE023985; Thu, 7 May 2015 09:57:17 +0200 Date: Thu, 07 May 2015 07:57:00 -0000 From: Jakub Jelinek To: Adrian Chadd Cc: gcc-patches@gcc.gnu.org Subject: Re: [rfc] gcc trunk - libgomp thread affinity for freebsd Message-ID: <20150507075717.GF1751@tucnak.redhat.com> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00516.txt.bz2 On Wed, May 06, 2015 at 04:29:02PM -0700, Adrian Chadd wrote: > This patch implements basic top level thread affinity support for > freebsd. It doesn't yet implement thread affinity support for > core/socket grouping yet; I'm working on a library to extract that out > to userland and plan on teaching libgomp about it at a later stage. > > https://people.freebsd.org/~adrian/gcc/20150506-gcc-trunk-libgomp-1.diff > > I'd appreciate feedback/review. In affinity.c, that sounds like way too much code duplication, besides slightly different includes (but, seems it is only added ones, not removed), the only differences I see are: 1) you are assuming HAVE_PTHREAD_AFFINITY_NP is defined, is that really needed? The configure test should pass and define this macro if you have it 2) cpu_set_t vs. cpuset_t 3) assuming CPU_ALLOC_SIZE is not defined and so aren't CPU_*_S 4) gomp_cpuset_popcount vs. CPU_COUNT 5) gomp_affinity_init_level is different 1) and 3) can be IMHO kept as is, for 2)/4) you could just add a short config/freebsd/affinity.c wrapper that includes right headers, defines a few macros and finally #include "../linux/affinity.c" For 5), guess that function could be moved into some header (affinity-init.h) and you could have a different version in config/linux and config/freebsd. As you add your own proc.c, I guess for 4) also just defining your own gomp_cpuset_popcount in there would work too. Jakub