Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 2014 12:23:29 +0800
From:      Xin Li <delphij@delphij.net>
To:        Adrian Chadd <adrian@freebsd.org>, Xin LI <delphij@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r269964 - head/sys/kern
Message-ID:  <5413C6C1.7090308@delphij.net>
In-Reply-To: <CAJ-Vmo=dx8Z6mX616A-SfzQqfT97F7h_kd-6KiWU2QW=YBSm=w@mail.gmail.com>
References:  <201408140531.s7E5VeWw077792@svn.freebsd.org> <CAJ-Vmo=dx8Z6mX616A-SfzQqfT97F7h_kd-6KiWU2QW=YBSm=w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 9/13/14 3:41 AM, Adrian Chadd wrote:
> Hi guys,
> 
> Both r269963 and r269964 have broken the MIPS platforms with
> smaller amounts of RAM (< 64MB.)
> 
> Sean noticed it and filed a bug:
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193465
> 
> Can we please figure out what changed? Otherwise I'm going to
> revert these two changes until we figure out what happened.

Could you please try if this would mitigate the issue?

Index: sys/kern/kern_malloc.c
===================================================================
- --- sys/kern/kern_malloc.c      (revision 271494)
+++ sys/kern/kern_malloc.c      (working copy)
@@ -717,6 +717,8 @@ kmeminit(void)
         * a given architecture.
         */
        mem_size = vm_cnt.v_page_count;
+       if (mem_size <= 32768) /* delphij XXX 128MB */
+               kmem_zmax = PAGE_SIZE;

        if (vm_kmem_size_scale < 1)
                vm_kmem_size_scale = VM_KMEM_SIZE_SCALE;



> Thanks,
> 
> 
> -a
> 
> 
> On 13 August 2014 22:31, Xin LI <delphij@freebsd.org> wrote:
>> Author: delphij Date: Thu Aug 14 05:31:39 2014 New Revision:
>> 269964 URL: http://svnweb.freebsd.org/changeset/base/269964
>> 
>> Log: Add a new loader tunable, vm.kmem_zmax which allows a system
>> administrator to limit the maximum allocation size that malloc(9)
>> would consider using the UMA cache allocator as backend.
>> 
>> Suggested by: alfred MFC after:    2 weeks
>> 
>> Modified: head/sys/kern/kern_malloc.c
>> 
>> Modified: head/sys/kern/kern_malloc.c 
>> ==============================================================================
>>
>> 
- --- head/sys/kern/kern_malloc.c Thu Aug 14 05:13:24 2014        (r269963)
>> +++ head/sys/kern/kern_malloc.c Thu Aug 14 05:31:39 2014
>> (r269964) @@ -172,6 +172,10 @@ u_long vm_kmem_size; 
>> SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN,
>> &vm_kmem_size, 0, "Size of kernel memory");
>> 
>> +static u_long kmem_zmax = KMEM_ZMAX; +SYSCTL_ULONG(_vm,
>> OID_AUTO, kmem_zmax, CTLFLAG_RDTUN, &kmem_zmax, 0, +    "Maximum
>> allocation size that malloc(9) would use UMA as backend"); + 
>> static u_long vm_kmem_size_min; SYSCTL_ULONG(_vm, OID_AUTO,
>> kmem_size_min, CTLFLAG_RDTUN, &vm_kmem_size_min, 0, "Minimum size
>> of kernel memory"); @@ -485,7 +489,7 @@ malloc(unsigned long
>> size, struct malloc size = redzone_size_ntor(size); #endif
>> 
>> -       if (size <= KMEM_ZMAX) { +       if (size <= kmem_zmax)
>> { mtip = mtp->ks_handle; if (size & KMEM_ZMASK) size = (size &
>> ~KMEM_ZMASK) + KMEM_ZBASE; @@ -776,6 +780,9 @@ mallocinit(void
>> *dummy)
>> 
>> uma_startup2();
>> 
>> +       if (kmem_zmax < PAGE_SIZE || kmem_zmax > KMEM_ZMAX) +
>> kmem_zmax = KMEM_ZMAX; + mt_zone = uma_zcreate("mt_zone",
>> sizeof(struct malloc_type_internal), #ifdef INVARIANTS 
>> mtrash_ctor, mtrash_dtor, mtrash_init, mtrash_fini, @@ -800,7
>> +807,7 @@ mallocinit(void *dummy) } for (;i <= size; i+=
>> KMEM_ZBASE) kmemsize[i >> KMEM_ZSHIFT] = indx; - + } } 
>> SYSINIT(kmem, SI_SUB_KMEM, SI_ORDER_SECOND, mallocinit, NULL);
>> 
> 

-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJUE8bBAAoJEJW2GBstM+nsxp8P+gLu9St6tQsTeSy2nWIe3wKY
PIvkntSRxPFnHFyHnaeSqdwpi1+7vVyb2kmy3fj/HYEvyiBwZf1mw4akOxUTjlo2
nTSISdnn07rACrnQXOxrc9gd0PDETbWzZuAZ5gOA5Y/REQ6DVl6nZUrtaBhzfuZr
OoQilpXTuP4n82tjl3OufjdN8ObcAlGigrjgjOxLL/deUfW5zktdkgrPSuFbtYYj
d5ERr2J48tTul0VnVBbeo7AfE082l/TKynnPJiKeJRhaE0oUVVlT2tkJjZz//E3k
Rw5dRdn0ptXroo88Pk/HdwxZi1eOTv2RJyz7zYIH9N8YLSZFNhGnrXbXbH6PFGqV
3cGaYIfiq4OTtSaY0nxjdRRllm/Alm0r9JSTw99nzCpW8G/QI5544znmNNZ52bCF
/Z/HNCVLWChzd4rQ4f8PWwjn06vCYhLGWFEH0DBdTRMRxCtBLDDyTBhePBebh7dc
RNFTG+1gPQSNXIPMBa/UU9YLqdXBqYYpD53qYKjYxovR3Yp1ZpjwsV1S2ehC4rFM
33+Rma7zVKkTaPsX9GTL4PhqWHyMXfUGbMD3VawAGAVxsJvDUgjVkWyTgWgfeZDi
AXq19g79MoGX5sDS1bGx24d9Yy8gEI6nQ0z0hvJSE3g/29+3JnlNgP6537vpSJTo
5+cK52wxY4fKff+Txr/Y
=mOQe
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5413C6C1.7090308>