I'm sitting on a few changes in devel/git since some time already.

- nghttp2 should not be listed here IMO.  It really is a dep of libcurl,
  git itself doesn't use directly the nghttp API.

- sysctl(HW_PHYSMEM) wants an int.  That doesn't work well if you have
  a decent amount or ram.  What doesn't work well either is storing that
  int in the first bytes of an uninitialized int64_t stack variable.
  Let's properly use HW_PHYSMEM64 instead.  I have left the HW_PHYSMEM
  code path so that the diff can be pushed upstream as-is without too
  many questions, but I'm not sure it makes much sense.

- with hw.smt=0, git may use more threads than the number of available
  cpu cores.  I initally noticed this when testing the hw.smt diffs on
  my x230 a few releases ago.  The simple solution is to reorder the
  code to avoid using HW_NCPU.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/git/Makefile,v
retrieving revision 1.204
diff -u -p -r1.204 Makefile
--- Makefile    25 Oct 2019 08:03:51 -0000      1.204
+++ Makefile    3 Nov 2019 10:23:16 -0000
@@ -5,7 +5,7 @@ COMMENT-svn =   subversion interoperabilit
 COMMENT-x11 =  graphical tools
 
 V =            2.23.0
-REVISION =     0
+REVISION =     1
 DISTNAME =     git-${V}
 PKGNAME-main = ${DISTNAME}
 PKGNAME-svn =  git-svn-${V}
@@ -49,8 +49,7 @@ WANTLIB-main =                c charset crypto curl ex
 RUN_DEPENDS-main =     devel/cvsps \
                        devel/p5-Error
 LIB_DEPENDS-main =     devel/gettext,-runtime \
-                       net/curl \
-                       www/nghttp2
+                       net/curl
 
 RUN_DEPENDS-svn =      ${BASE_PKGPATH} \
                        devel/subversion,-perl \
Index: patches/patch-builtin_gc_c
===================================================================
RCS file: patches/patch-builtin_gc_c
diff -N patches/patch-builtin_gc_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-builtin_gc_c  3 Nov 2019 10:23:16 -0000
@@ -0,0 +1,38 @@
+$OpenBSD$
+
+HW_PHYSMEM asks for an int, not an int64_t.
+Use HW_PHYSMEM64 to handle ram size > 2GB.
+
+Index: builtin/gc.c
+--- builtin/gc.c.orig
++++ builtin/gc.c
+@@ -244,7 +244,7 @@ static uint64_t total_ram(void)
+ 
+       if (!sysinfo(&si))
+               return si.totalram;
+-#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM))
++#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || 
defined(HW_PHYSMEM64))
+       int64_t physical_memory;
+       int mib[2];
+       size_t length;
+@@ -253,9 +253,19 @@ static uint64_t total_ram(void)
+ # if defined(HW_MEMSIZE)
+       mib[1] = HW_MEMSIZE;
+ # else
+-      mib[1] = HW_PHYSMEM;
++      mib[1] = HW_PHYSMEM64;
+ # endif
+       length = sizeof(int64_t);
++      if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0))
++              return physical_memory;
++#elif defined(HAVE_BSD_SYSCTL) && defined(HW_PHYSMEM))
++      int physical_memory;
++      int mib[2];
++      size_t length;
++
++      mib[0] = CTL_HW;
++      mib[1] = HW_PHYSMEM;
++      length = sizeof(int);
+       if (!sysctl(mib, 2, &physical_memory, &length, NULL, 0))
+               return physical_memory;
+ #elif defined(GIT_WINDOWS_NATIVE)
Index: patches/patch-thread-utils_c
===================================================================
RCS file: patches/patch-thread-utils_c
diff -N patches/patch-thread-utils_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-thread-utils_c        3 Nov 2019 10:23:16 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+
+Use sysconf(_SC_NPROCESSORS_ONLN) to properly omit disabled smt cores.
+
+Index: thread-utils.c
+--- thread-utils.c.orig
++++ thread-utils.c
+@@ -25,9 +25,10 @@ int online_cpus(void)
+ #else
+ #ifdef _SC_NPROCESSORS_ONLN
+       long ncpus;
+-#endif
+ 
+-#ifdef GIT_WINDOWS_NATIVE
++      if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
++              return (int)ncpus;
++#elif defined(GIT_WINDOWS_NATIVE)
+       SYSTEM_INFO info;
+       GetSystemInfo(&info);
+ 
+@@ -55,11 +56,6 @@ int online_cpus(void)
+       if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
+               return cpucount;
+ #endif /* defined(HAVE_BSD_SYSCTL) && defined(HW_NCPU) */
+-
+-#ifdef _SC_NPROCESSORS_ONLN
+-      if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
+-              return (int)ncpus;
+-#endif
+ 
+       return 1;
+ #endif


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to