Skip to content
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

Enable memory overcommit #1798

Merged
merged 1 commit into from
Jan 17, 2020
Merged

Enable memory overcommit #1798

merged 1 commit into from
Jan 17, 2020

Conversation

alexgg
Copy link
Contributor

@alexgg alexgg commented Jan 8, 2020

Move the memory overcommit settings from the Raspberry Pi integration
layer to meta-balena so it applies to all device types.

Fixes #1791

Change-type: patch
Changelog-entry: Enable memory overcommit
Signed-off-by: Alex Gonzalez alexg@balena.io


Contributor checklist

Reviewer Guidelines

  • When submitting a review, please pick:
    • 'Approve' if this change would be acceptable in the codebase (even if there are minor or cosmetic tweaks that could be improved).
    • 'Request Changes' if this change would not be acceptable in our codebase (e.g. bugs, changes that will make development harder in future, security/performance issues, etc).
    • 'Comment' if you don't feel you have enough information to decide either way (e.g. if you have major questions, or you don't understand the context of the change sufficiently to fully review yourself, but want to make a comment)

Related to https://github.com/balena-os/balena-raspberrypi/tree/alexgg/%23440-mem-overcommit

@alexgg alexgg requested a review from ZubairLK as a code owner January 8, 2020 11:27
@alexgg
Copy link
Contributor Author

alexgg commented Jan 8, 2020

Quick sanity tests:

  • genericx86-64 correctly sets the vm.overcommit_memory
  • Tested with values of 1 and 2, 1 correctly allows to overcommit memory (now the default) while 2 doesn't with the following snippet:
#include <stdio.h>                                                                 
#include <string.h>                                                                
#include <stdlib.h>                                                                
                                                                                   
int main (void) {                                                                  
    int n = 0;                                                                     
    char *p;                                                                       
                                                                                   
    while (1) {                                                                    
        if ((p = malloc(1<<20)) == NULL) {                                         
                printf("malloc failure after %d MiB\n", n);                        
                return 0;                                                          
        }                                                                          
        memset (p, 0, (1<<20));                                                    
        printf ("got %d MiB\n", ++n);                                              
    }                                                                              
} 

@alexgg
Copy link
Contributor Author

alexgg commented Jan 8, 2020

Associated branch in balena-raspberrypi:
https://github.com/balena-os/balena-raspberrypi/tree/alexgg/%23440-mem-overcommit

@alexgg alexgg requested review from floion and vicgal January 14, 2020 12:23
Move the memory overcommit settings from the Raspberry Pi integration
layer to meta-balena so it applies to all device types.

Fixes #1791

Change-type: patch
Changelog-entry: Enable memory overcommit
Signed-off-by: Alex Gonzalez <alexg@balena.io>
@alexgg alexgg force-pushed the alexgg/#1791-mem-overcommit branch from af65708 to fcfedc4 Compare January 15, 2020 10:31
@alexgg
Copy link
Contributor Author

alexgg commented Jan 15, 2020

v2: Use systemd-sysctl instead

@ZubairLK
Copy link
Contributor

@balena-ci retest

@alexgg alexgg merged commit 252b652 into development Jan 17, 2020
@ZubairLK ZubairLK deleted the alexgg/#1791-mem-overcommit branch January 17, 2020 11:39
ZubairLK pushed a commit that referenced this pull request Jan 17, 2020
ZubairLK pushed a commit that referenced this pull request Jan 29, 2020
floion added a commit to balena-os/balena-raspberrypi that referenced this pull request Jan 31, 2020
This is now done directly in meta-balena instead. See
balena-os/meta-balena#1798

Signed-off-by: Florin Sarbu <florin@balena.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable memory overcommit for all device types
3 participants