Changes in / [d3261710:6a33e40]
- Files:
-
- 4 edited
-
benchmark/io/http/Makefile.am (modified) (1 diff)
-
benchmark/io/http/main.cfa (modified) (4 diffs)
-
libcfa/src/concurrency/kernel_private.hfa (modified) (1 diff)
-
libcfa/src/concurrency/ready_queue.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/Makefile.am
rd3261710 r6a33e40 21 21 include $(top_srcdir)/tools/build/cfa.make 22 22 23 AM_CFLAGS = -O 3-Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror23 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror 24 24 AM_CFAFLAGS = -quiet -nodebug 25 25 AM_LDFLAGS = -quiet -nodebug -
benchmark/io/http/main.cfa
rd3261710 r6a33e40 1 #define _ GNU_SOURCE1 #define __USE_GNU 2 2 3 3 #include <errno.h> … … 6 6 #include <unistd.h> 7 7 extern "C" { 8 #include <sched.h>9 8 #include <signal.h> 10 9 #include <sys/socket.h> … … 68 67 (this.self){ "Server Cluster", options.clopts.params }; 69 68 70 cpu_set_t fullset;71 CPU_ZERO(&fullset);72 int ret = sched_getaffinity(getpid(), sizeof(fullset), &fullset);73 if( ret != 0 ) abort | "sched_getaffinity failed with" | errno | strerror( errno );74 int cnt = CPU_COUNT(&fullset);75 76 69 this.procs = alloc(options.clopts.nprocs); 77 70 for(i; options.clopts.nprocs) { 78 71 (this.procs[i]){ "Benchmark Processor", this.self }; 79 80 int c = 0;81 int n = 1 + (i % cnt);82 for(int j = 0; j < CPU_SETSIZE; j++) {83 if(CPU_ISSET(j, &fullset)) n--;84 if(n == 0) {85 c = j;86 break;87 }88 }89 cpu_set_t localset;90 CPU_ZERO(&localset);91 CPU_SET(c, &localset);92 ret = pthread_setaffinity_np(this.procs[i].kernel_thread, sizeof(localset), &localset);93 if( ret != 0 ) abort | "sched_getaffinity failed with" | ret | strerror( ret );94 72 95 73 #if !defined(__CFA_NO_STATISTICS__) … … 168 146 int waited = 0; 169 147 for() { 170 int sockfd = server_fd; 171 __CONST_SOCKADDR_ARG addr; 172 addr.__sockaddr__ = (struct sockaddr *)&address; 173 socklen_t addrlen = sizeof(address); 174 ret = bind( sockfd, addr, addrlen ); 148 ret = bind( server_fd, (struct sockaddr *)&address, sizeof(address) ); 175 149 if(ret < 0) { 176 150 if(errno == EADDRINUSE) { -
libcfa/src/concurrency/kernel_private.hfa
rd3261710 r6a33e40 219 219 220 220 // Step 2 : acquire our local lock 221 /*paranoid*/ verify(!kernelTLS().sched_lock);222 221 __atomic_acquire( &kernelTLS().sched_lock ); 223 222 /*paranoid*/ verify(kernelTLS().sched_lock); -
libcfa/src/concurrency/ready_queue.cfa
rd3261710 r6a33e40 201 201 uint_fast32_t ready_mutate_lock( void ) with(*__scheduler_lock) { 202 202 /* paranoid */ verify( ! __preemption_enabled() ); 203 /* paranoid */ verify( ! kernelTLS().sched_lock ); 203 204 204 205 // Step 1 : lock global lock … … 206 207 // to simply lock their own lock and enter. 207 208 __atomic_acquire( &write_lock ); 208 209 // Make sure we won't deadlock ourself210 // Checking before acquiring the writer lock isn't safe211 // because someone else could have locked us.212 /* paranoid */ verify( ! kernelTLS().sched_lock );213 209 214 210 // Step 2 : lock per-proc lock
Note:
See TracChangeset
for help on using the changeset viewer.