Otto Moerbeek wrote:
> Hi,
> 
> Pages in the malloc cache are either reused quickly or unmapped
> quickly. In both cases it does not make sense to set hints on them.
> So remove that option, which is just a remainder of old times when
> mallco used to hold on to pages. OK?

Makes sense. ok stefan@
 
>       -Otto
> 
> Index: lib/libc/stdlib/malloc.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
> retrieving revision 1.207
> diff -u -p -r1.207 malloc.c
> --- lib/libc/stdlib/malloc.c  22 Oct 2016 14:27:19 -0000      1.207
> +++ lib/libc/stdlib/malloc.c  28 Oct 2016 08:52:05 -0000
> @@ -176,7 +176,6 @@ struct malloc_readonly {
>       int     malloc_mt;              /* multi-threaded mode? */
>       int     malloc_freenow;         /* Free quickly - disable chunk rnd */
>       int     malloc_freeunmap;       /* mprotect free pages PROT_NONE? */
> -     int     malloc_hint;            /* call madvice on free pages?  */
>       int     malloc_junk;            /* junk fill? */
>       int     malloc_move;            /* move allocations to end of page? */
>       int     malloc_realloc;         /* always realloc? */
> @@ -374,8 +373,6 @@ unmap(struct dir_info *d, void *p, size_
>                                   MALLOC_MAXCHUNK : sz;
>                               memset(p, SOME_FREEJUNK, amt);
>                       }
> -                     if (mopts.malloc_hint)
> -                             madvise(p, sz, MADV_FREE);
>                       if (mopts.malloc_freeunmap)
>                               mprotect(p, sz, PROT_NONE);
>                       r->p = p;
> @@ -447,8 +444,6 @@ map(struct dir_info *d, void *hint, size
>                               d->free_regions_size -= psz;
>                               if (mopts.malloc_freeunmap)
>                                       mprotect(p, sz, PROT_READ | PROT_WRITE);
> -                             if (mopts.malloc_hint)
> -                                     madvise(p, sz, MADV_NORMAL);
>                               if (zero_fill)
>                                       memset(p, 0, sz);
>                               else if (mopts.malloc_junk == 2 &&
> @@ -465,8 +460,6 @@ map(struct dir_info *d, void *hint, size
>               r->p = (char *)r->p + (psz << MALLOC_PAGESHIFT);
>               if (mopts.malloc_freeunmap)
>                       mprotect(p, sz, PROT_READ | PROT_WRITE);
> -             if (mopts.malloc_hint)
> -                     madvise(p, sz, MADV_NORMAL);
>               r->size -= psz;
>               d->free_regions_size -= psz;
>               if (zero_fill)
> @@ -531,12 +524,6 @@ omalloc_parseopt(char opt)
>               break;
>       case 'G':
>               mopts.malloc_guard = MALLOC_PAGESIZE;
> -             break;
> -     case 'h':
> -             mopts.malloc_hint = 0;
> -             break;
> -     case 'H':
> -             mopts.malloc_hint = 1;
>               break;
>       case 'j':
>               if (mopts.malloc_junk > 0)
> Index: share/man/man5/malloc.conf.5
> ===================================================================
> RCS file: /cvs/src/share/man/man5/malloc.conf.5,v
> retrieving revision 1.9
> diff -u -p -r1.9 malloc.conf.5
> --- share/man/man5/malloc.conf.5      17 Oct 2016 06:29:08 -0000      1.9
> +++ share/man/man5/malloc.conf.5      28 Oct 2016 08:52:09 -0000
> @@ -73,10 +73,6 @@ option for security).
>  Enable guard pages.
>  Each page size or larger allocation is followed by a guard page that will
>  cause a segmentation fault upon any access.
> -.It Cm H
> -.Dq Hint .
> -Pass a hint to the kernel about pages we don't use.
> -If the machine is paging a lot this may help a bit.
>  .It Cm J
>  .Dq More junking .
>  Increase the junk level by one if it is smaller than 2.
> 
> 

Reply via email to