pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/56432: sysutils/conky miscalculates mem requirements



>Number:         56432
>Category:       pkg
>Synopsis:       sysutils/conky miscalculates mem requirements
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 02 03:30:00 +0000 2021
>Originator:     Stefan Schaeckeler
>Release:        pkgsrc-2021Q3
>Organization:
>Environment:
NetBSD xxx 9.2_STABLE NetBSD 9.2_STABLE (GENERIC) #2: Sat Sep 18 19:22:24 PDT 2021  root@xxx:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
I have 4 GB of memory

dmesg | grep memory
[     1.000000] total memory = 3963 MB
[     1.000000] avail memory = 3824 MB


That's what top shows at one point in time:

Memory: 1964M Act, 1144M Inact, 28M Wired, 49M Exec, 2974M File, 380M Free

For reasons unknown to me, we have active + file > 4 GB of memory. That's why these recently committed formulae to netbsd.c:update_meminfo() are not correct:

        info.mem = ((uvmexp.active + uvmexp.wired) * uvmexp.pagesize) / 1024;
        info.memmax = (uvmexp.npages * uvmexp.pagesize) / 1024;
        info.cached = ((uvmexp.filepages + uvmexp.execpages) * uvmexp.pagesize) / 1024;

        info.mem += info.cached;


They result in negative free memory:

memmax 3919468 | mem 5136828 | memfree -1217360 | cached 3095576
active 503126 | wired 7187 | filepages 761126 | execpages 12768 | pagesize 4096 | npages 979867


This negative memfree also shows up on conky's ~/.conkyrc $memfree. Basically, that's how I noticed this issue.
>How-To-Repeat:

Above log comes from adding to src/netbsd.c:update_meminfo() just before the return 0:

        printf("memmax %lld | mem %lld | memfree %lld | cached %lld\n", 
                   info.memmax, info.mem, info.memfree, info.cached );
        printf("active %ld | wired %ld | filepages %ld | execpages %ld | pagesize %ld | npages %ld\n", 
                   uvmexp.active, uvmexp.wired, uvmexp.filepages, uvmexp.execpages, uvmexp.pagesize, uvmexp.npages);


>Fix:



Home | Main Index | Thread Index | Old Index