From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ray Bryant Date: Tue, 23 Nov 2004 20:42:36 +0000 Subject: Re: scalability of signal delivery for Posix Threads Message-Id: <41A3A0BC.9080006@sgi.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------020803050208060509030506" List-Id: References: <41A20AF3.9030408@sgi.com> <20041122171932.GA19440@lnx-holt.americas.sgi.com> In-Reply-To: <20041122171932.GA19440@lnx-holt.americas.sgi.com> To: Robin Holt Cc: Kernel Mailing List , "linux-ia64@vger.kernel.org" , lse-tech , Dean Roe , Brian Sumner , John Hawkes This is a multi-part message in MIME format. --------------020803050208060509030506 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Robin Holt wrote: > > Ray, can you provide a simple example application that trips this case? > Robin, Attached is a pthreads program (y.c) that exercises the scaling problem discussed above. Compile this as: gcc y.c -o y -lpthread -lm Call it as: ./y nthread We start to see problems on Altix with this program at around 76 cpus. -- Best Regards, Ray ----------------------------------------------- Ray Bryant 512-453-9679 (work) 512-507-7807 (cell) raybry@sgi.com raybry@austin.rr.com The box said: "Requires Windows 98 or better", so I installed Linux. ----------------------------------------------- --------------020803050208060509030506 Content-Type: text/plain; name="y.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="y.c" #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #define NITER 100000000 #define perrorx(s) (perror(s), exit(1)) #define MAX_THREADS 512 #define CACHE_LINE_SIZE 128 #define __cache_aligned __attribute__((__aligned__(CACHE_LINE_SIZE))) static struct itimerval itv; /* this makes count a per thread variable */ static __thread unsigned volatile long count; pthread_t ptid[MAX_THREADS]; struct child_state_struct { int state; pid_t tid; long start_count; long end_count; double result; char filler[CACHE_LINE_SIZE - (sizeof(int)+sizeof(pid_t)+2*sizeof(long)+sizeof(double))]; }; struct child_state_struct child_state[MAX_THREADS] __cache_aligned; volatile int go __cache_aligned = 0; char filler[CACHE_LINE_SIZE - (sizeof(int))]; static void sigprof_handler(int signo, struct siginfo *sip, void *scp) { ++count; } void *func(void *arg) { int i, id = (int)(long)arg; double a = 0.1; pid_t tid; tid = syscall(__NR_gettid); child_state[id].tid = tid; child_state[id].state = 1; if (setitimer(ITIMER_PROF, &itv, 0) < 0) { fprintf(stderr, "Setitimer failed: %s\n", strerror(errno)); exit(1); } while(go<1); child_state[id].start_count = count; for (i=0;i