-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive memory_throttle_count value on i386 #831
Comments
Until we properly abandon vmalloc() there's probably not much we can do about this. 32-bit systems have such a limited virtual address space. |
@behlendorf I do not believe that is the case. The following items contradict the idea that the limited virtual address space is the cause:
I spent some time on this with @amospalla. He increased vmalloc, zfs_arc_max and zfs_arc_meta_limit, but none of that had any effect. I believe that there is some kind of arithmetic error occurring with 32-bit arithmetic, although I do not currently understand what that is. There were reports that pull request #651 prevents this issue, but I currently do not understand why. |
Pull request #1034 might address this issue. |
After talking with @amospalla in IRC, it turns out that pull request #1034 does not completely address his issue. However, adding the following patch to his kernel module does make the excessive throttle issue go away:
This was only difference between what was being done on @lundman's system and what was being done on @amospalla's system. I provided him with a patch that deleted those lines on the suspicion that it was the problem and a paste of his arcstatus following an rsync involving 2GB of files showed memory_throttle_count to be 0. The implication is that vmem_size(heap_arena, VMEM_FREE) is returning some obscenely small value, causing ARC to throttle indefinitely. |
This is surprising:
It looks like the return value of
vmem_size() is only used in ARC and splat, but it needs a rewrite. |
Could you be more specific because by my reading of the code vmem_size() is working exactly as intended. The issue is more that the virtual address space on 32-bit Linux is tiny, tiny, tiny compared to OpenSolaris and FreeBSD. We're talking about 100MB by default on Linux compared to many GBs for the other platforms. This __i386 code was something which I brought over from Solaris unmodified and never seriously focused on since 32-bit systems have never been a high priority. Now since the expectations about the virtual memory subsystem on Linux are so different than on Solaris it's not to surprising this code is just wrong. Since we have good reason to believe this code is causing problems on the 32-bit Linux system I suggest we just drop it.
This hunk should certainly go since almost by definition it's going to be a small value. On 32-bit Linux systems the expectation right now is that almost all this space will be consumed by the ARC.
This is already 100% dead code on Linux for all builds. I never implemented the concept of VM arenas in the SPL layer for Linux so
For now this still makes sense since the ARC is still largely backed by the virtual address space. We should be careful never to automatically size it larger than this. Once the ARC is backed by the page cache this can also be dropped. At which point we'll be able to remove vmem_size() entirely from the SPL which will be a good thing. Anyway, I'm proposing @ryao 's original fix for this issue, behlendorf/zfs@cf86aeb with just a little more commentary. Any additional 32-bit testing with this bring would be appreciated. |
I went to HEAD, and applied behlendorf@cf86aeb and have no issues with it.
I loaded ZFS with insmod ./module/zfs/zfs.ko zfs_arc_max=41943040 zfs_vdev_cache_size=5242880 |
@behlendorf I was wrong to say that the value of vmem_size(zio_arena, VMEM_FREE) was being set at compile time. The value of VMALLOC_TOTAL is set at compile time, even though it can be modified with vmalloc as a kernel commandline parameter. However, it is using a value that was determined at compile time as the total amount of kernel virtual address space. For instance, As for arc_evict_needed(), you are correct that the code that I cited was dead code. I didn't realize that zio_arena was a NULL value when I was looking at it. |
I applied #1034 to test on the 32bit ARM, and I did not notice any particular speedup. But then, with previous fixes, the throttle is now at "0" both before and after. The fix does no harm here at least.
|
That's to be expected it was all dead code for ARM. Still this is progress in the right direction. Now -rc12 when tagged should at least build and basically function for ARM. I'm sure there's more tuning which could be done but that's going to be an incremental thing. |
Thanks for running this one down guys, I've merged it in to master. I'd be very interested to hear what sort of tunings are still needed to run reliably on a 32-bit system. |
@behlendorf Issue #749 showed that the following works: zfs_arc_max=41943040 These probably are far from optimal, but they are at least known to be sane. |
There are currently three vmem_size() consumers all of which are part of the ARC implemention. However, since the expected behavior of the Linux and Solaris virtual memory subsystems are so different the behavior in each of these instances needs to be reevaluated. * arc_evict_needed() - This is actually dead code. Arena support was never added to the SPL and zio_arena is always NULL. This support isn't needed so we simply remove this dead code. * arc_memory_throttle() - On Solaris where virtual memory constitutes almost all of the address space we can reasonably expect there to be a fairly large amount free. However, on Linux by default we only have about 100MB total and that's heavily used by the ARC. So the expectation on Linux is that this will usually be a small value. Therefore we remove the vmem_size() check for i386 systems because the expectation is that it will be less than the zfs_write_limit_max. * arc_init() - Here vmem_size() is used to initially size the ARC. Since the ARC is currently backed by the virtual address space it makes sense to use this as a limit on the ARC for 32-bit systems. This code can be removed when the ARC is backed by the page cache. Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#831
…zfs#831) Bumps [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) from 0.3.4 to 0.3.6. - [Release notes](https://github.com/sunfishcode/linux-raw-sys/releases) - [Commits](sunfishcode/linux-raw-sys@v0.3.4...v0.3.6) --- updated-dependencies: - dependency-name: linux-raw-sys dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Gentoo Linux running OpenVZ 042stab057.1 kernel (based upon 2.6.32 Red Hat), arcstats http://pastebin.com/5cbgdxPY.
The text was updated successfully, but these errors were encountered: