Project

General

Profile

Bug #7016

arc_available_memory is not 32-bit safe

Added by Igor Kozhukhov over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2016-05-31
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

History

#1

Updated by Igor Kozhukhov over 3 years ago

  • Description updated (diff)
  • Status changed from New to In Progress
#2

Updated by Matthew Ahrens over 3 years ago

Alexander Motin from FreeBSD report this issue about arc_available_memory on 32-bit systems:

On Wed, Aug 12, 2015 at 1:59 AM, Alexander Motin <
<mailto:>> wrote:
While testing your commit 2ec99e3e987d8aa273f1e9ba2b983557d058198c for
bug 5376 merged to FreeBSD I experienced a problem, which original cause
appeared to be FreeBSD-specific, but then made me think it is partially
possible on Illumos too. There are such parts in that commit:

- if (vmem_size(heap_arena, VMEM_FREE) <
- (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2))
- return (1);
+ n = vmem_size(heap_arena, VMEM_FREE) -
+ (vmem_size(heap_arena, VMEM_FREE | VMEM_ALLOC) >> 2);

The problem is that vmem_size() returns size_t result, which is uint32_t
on 32-bit platforms. Attempt to convert result of subtraction to int64_t
won't give negative value, but instead something about 2^^32.

Am I right? Should there be (int64_t) conversion added before first
vmem_size?

While we are at it, don't let the zio_arena get too full, and add a tunable to control how full it can get. Note that this should not have any impact now that we have the fix for 6914, but it's nice to have the tunable anyway rather than a hard-coded value.

#3

Updated by Electric Monk over 3 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 0dd053d7d890618ea1fc697b07de364e69eb4190

commit  0dd053d7d890618ea1fc697b07de364e69eb4190
Author: Prakash Surya <prakash.surya@delphix.com>
Date:   2016-06-03T15:16:37.000Z

    7016 arc_available_memory is not 32-bit safe
    Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Paul Dagnelie <pcd@delphix.com>
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Approved by: Gordon Ross <gordon.ross@nexenta.com>

Also available in: Atom PDF