2015-12-05 11:51 GMT+01:00 Mark Geisert <mark@maxrnd.com>:
Mark Geisert wrote:
In the OP's very good testcase the most heavily contended locks, by far, are
those internal to git's builtin/pack-objects.c. I plan to show actual stats
after some more cleanup, but I did notice something in that git source file
that might explain the difference between Cygwin and MinGW when running this
testcase...
#ifndef NO_PTHREADS
static pthread_mutex_t read_mutex;
#define read_lock() pthread_mutex_lock(&read_mutex)
#define read_unlock() pthread_mutex_unlock(&read_mutex)
static pthread_mutex_t cache_mutex;
#define cache_lock() pthread_mutex_lock(&cache_mutex)
#define cache_unlock() pthread_mutex_unlock(&cache_mutex)
static pthread_mutex_t progress_mutex;
#define progress_lock() pthread_mutex_lock(&progress_mutex)
#define progress_unlock() pthread_mutex_unlock(&progress_mutex)
#else
#define read_lock() (void)0
#define read_unlock() (void)0
#define cache_lock() (void)0
#define cache_unlock() (void)0
#define progress_lock() (void)0
#define progress_unlock() (void)0
#endif
Is it possible the MinGW version of git is compiled with NO_PTHREADS
#defined? If so, it would mean there's no locking being done at all and
would explain the faster execution and near 100% CPU utilization when
running under MinGW.
Nah, there is no threading enabled when there is no pthreads. How
would that work? :D See thread-utils.h
#ifndef NO_PTHREADS
#include <pthread.h>
extern int online_cpus(void);
extern int init_recursive_mutex(pthread_mutex_t*);
#else
#define online_cpus() 1
#endif