[pve-devel] applied: [PATCH common] ProcFSTools: fix read_meminfo without KSM

Thomas Lamprecht t.lamprecht at proxmox.com
Tue May 5 18:26:15 CEST 2020


On 5/5/20 5:01 PM, Stoiko Ivanov wrote:
> on kernel configs where KSM is not enabled (e.g. an openstack instance at
> OVH) the file /sys/kernel/mm/ksm/pages_sharing does not exist.
> In that case there is no memory shared so assuming 0 is reasonable.
> 
> While this is not the case with our shipped kernel, and thus will probably
> not happen on a PVE installation, PMG can run quite happily with a different
> kernel (the reporter had this on an openstack instance at OVH).
> 
> a quick grep through our codebase showed only the API2::Nodes::Nodeinfo::status
> call as user of the memshared property.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> reported in our forum:
> https://forum.proxmox.com/threads/pmg-smtp-filter-19469-warning-use-of-uninitialized-value-spages.69231/
> 
>  src/PVE/ProcFSTools.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
> index 7f905f4..e413ccf 100644
> --- a/src/PVE/ProcFSTools.pm
> +++ b/src/PVE/ProcFSTools.pm
> @@ -249,7 +249,7 @@ sub read_meminfo {
>      $res->{swapfree} = $d->{swapfree};
>      $res->{swapused} = $res->{swaptotal} - $res->{swapfree};
>  
> -    my $spages = PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing");
> +    my $spages = PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing") // 0 ;
>      $res->{memshared} = int($spages) * 4096;
>  
>      return $res;
> 

applied, thanks!




More information about the pve-devel mailing list