Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-14 Thread Junio C Hamano
Duy Nguyen writes: > We don't hold this memory forever though. If the daemon is idle for a > while, it exits, releasing memory back to system. And not using > mlock() already gives the OS more freedom in memory usage. Yup, that is why I suspected you wanted to use something other than mlock(). -

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-14 Thread Duy Nguyen
On Fri, Apr 15, 2016 at 1:12 AM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On Wed, Apr 13, 2016 at 1:05 AM, Junio C Hamano wrote: > - access is slow (unless cached, but we can't be sure) We could solve this (and the other problem) with mlock. >>> >>> Probably you meant madvi

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-14 Thread David Turner
On Thu, 2016-04-14 at 11:12 -0700, Junio C Hamano wrote: > Duy Nguyen writes: > > > On Wed, Apr 13, 2016 at 1:05 AM, Junio C Hamano > > wrote: > > > > > - access is slow (unless cached, but we can't be sure) > > > > > > > > We could solve this (and the other problem) with mlock. > > > > > > P

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-14 Thread Junio C Hamano
Duy Nguyen writes: > On Wed, Apr 13, 2016 at 1:05 AM, Junio C Hamano wrote: - access is slow (unless cached, but we can't be sure) >>> >>> We could solve this (and the other problem) with mlock. >> >> Probably you meant madvise(2)? >> >> For something of a size comparable to the index file

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-14 Thread Duy Nguyen
On Wed, Apr 13, 2016 at 1:05 AM, Junio C Hamano wrote: >>> - access is slow (unless cached, but we can't be sure) >> >> We could solve this (and the other problem) with mlock. > > Probably you meant madvise(2)? > > For something of a size comparable to the index file held by > index-helper-daemon

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-12 Thread David Turner
On Tue, 2016-04-12 at 11:05 -0700, Junio C Hamano wrote: > > > - access is slow (unless cached, but we can't be sure) > > > > We could solve this (and the other problem) with mlock. > > Probably you meant madvise(2)? > > For something of a size comparable to the index file held by > index-helpe

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-12 Thread Junio C Hamano
David Turner writes: >> I avoided actual files for two reasons >> >> - disk error rate is higher than memory one, and we might need >> trailing SHA-1 back > > This only matters if we ever *read* the mmap off disk. But that will > rarely happen -- usually, everything will stay in memory. True,

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-12 Thread David Turner
On Tue, 2016-04-12 at 16:40 +0700, Duy Nguyen wrote: > On Tue, Apr 12, 2016 at 6:27 AM, David Turner < > dtur...@twopensource.com> wrote: > > On Fri, 2016-04-08 at 18:16 -0400, David Turner wrote: > > > And SHM on Macs works a bit differently than on Linux in at least > > > two > > > irritating way

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-12 Thread Duy Nguyen
On Tue, Apr 12, 2016 at 6:27 AM, David Turner wrote: > On Fri, 2016-04-08 at 18:16 -0400, David Turner wrote: >> And SHM on Macs works a bit differently than on Linux in at least two >> irritating ways. >> >> So, uh, new version to come once I actually make it work on Mac. >> Probably Monday. > >

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-11 Thread David Turner
On Fri, 2016-04-08 at 18:16 -0400, David Turner wrote: > And SHM on Macs works a bit differently than on Linux in at least two > irritating ways. > > So, uh, new version to come once I actually make it work on Mac. > Probably Monday. I was chatting with a friend about this and he mentioned that

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-08 Thread David Turner
On Fri, 2016-04-08 at 18:26 +0700, Duy Nguyen wrote: > On Thu, Apr 7, 2016 at 5:11 AM, David Turner < > dtur...@twopensource.com> wrote: > > @@ -1045,4 +1046,21 @@ struct tm *git_gmtime_r(const time_t *, > > struct tm *); > > #define getc_unlocked(fh) getc(fh) > > #endif > > > > +#ifdef __linux_

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-08 Thread Johannes Schindelin
Hi David, On Thu, 7 Apr 2016, David Turner wrote: > On Thu, 2016-04-07 at 16:14 +0200, Johannes Schindelin wrote: > > > > On Thu, 7 Apr 2016, Johannes Sixt wrote: > > > > > Am 07.04.2016 um 00:11 schrieb David Turner: > > > > +static void share_index(struct index_state *istate, struct shm > > >

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-08 Thread Duy Nguyen
On Thu, Apr 7, 2016 at 5:11 AM, David Turner wrote: > @@ -1045,4 +1046,21 @@ struct tm *git_gmtime_r(const time_t *, struct tm *); > #define getc_unlocked(fh) getc(fh) > #endif > > +#ifdef __linux__ > +#define UNIX_PATH_MAX 108 > +#elif defined(__APPLE__) || defined(BSD) > +#define UNIX_PATH_MAX

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-07 Thread David Turner
On Thu, 2016-04-07 at 16:14 +0200, Johannes Schindelin wrote: > Hi, > > On Thu, 7 Apr 2016, Johannes Sixt wrote: > > > Am 07.04.2016 um 00:11 schrieb David Turner: > > > +static void share_index(struct index_state *istate, struct shm > > > *is) > > > +{ > > > + void *new_mmap; > > > + if (istate-

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-07 Thread Johannes Schindelin
Hi, On Thu, 7 Apr 2016, Johannes Sixt wrote: > Am 07.04.2016 um 00:11 schrieb David Turner: > > +static void share_index(struct index_state *istate, struct shm *is) > > +{ > > + void *new_mmap; > > + if (istate->mmap_size <= 20 || > > + hashcmp(istate->sha1, > > + (unsigne

Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff

2016-04-06 Thread Johannes Sixt
Am 07.04.2016 um 00:11 schrieb David Turner: +static void share_index(struct index_state *istate, struct shm *is) +{ + void *new_mmap; + if (istate->mmap_size <= 20 || + hashcmp(istate->sha1, + (unsigned char *)istate->mmap + istate->mmap_size - 20) || +