lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 09 Feb 2024 01:56:03 -0800
From: Andi Kleen <ak@...ux.intel.com>
To: Chunsheng Luo <luochunsheng@...c.edu>
Cc: gregkh@...uxfoundation.org,  rafael@...nel.org,
  akpm@...ux-foundation.org,  linux-kernel@...r.kernel.org,
  linux-mm@...ck.org
Subject: Re: [PATCH] meminfo: provide estimated per-node's available memory

Chunsheng Luo <luochunsheng@...c.edu> writes:

> +	available = sum_zone_node_page_state(nid, NR_FREE_PAGES) - pgdat->totalreserve_pages;
> +
> +	/*
> +	 * Not all the page cache can be freed, otherwise the system will
> +	 * start swapping or thrashing. Assume at least half of the page
> +	 * cache, or the low watermark worth of cache, needs to stay.
> +	 */
> +	pagecache = node_page_state(pgdat, NR_ACTIVE_FILE) +
> +		node_page_state(pgdat, NR_INACTIVE_FILE);
> +	pagecache -= min(pagecache / 2, wmark_low);


The magic number 2 should be a define (or maybe even a tunable). Similar
below. It seems quite arbitrary, but I don't have a better solution
either. Maybe could handle dirty differently, but nothing stands out here


> +		node_page_state(pgdat, NR_KERNEL_MISC_RECLAIMABLE);
> +	reclaimable -= min(reclaimable / 2, wmark_low);
> +	available += reclaimable;
> +
> +	if (available < 0)
> +		available = 0;

That would be a bug? Perhaps add a WARN_ON


With those changes:

Reviewed-by: Andi Kleen <ak@...ux.intel.com>



-Andi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ