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-next>] [day] [month] [year] [list]
Date:	Sun, 12 Jul 2009 23:45:26 -0700
From:	Mitchell Erblich <erblichs@...thlink.net>
To:	linux-kernel@...r.kernel.org
Subject: Suggested code change: slab.c : Moderately simple : reap based on last access time and show LAST access AGE


	* The basis of the below changes deal with STANDARD rules that caches
	are time dependent when dealing with their objects. We assume re-use
	shortly after frees and as time moves forward a lower percentage of  
objects
	will be re-used.

	If I understand the Linux SLAB implementation then ..

	SLAB Caches IMO should NORMALLY be reaped ONLY after X time has  
passed after
	the last object is freed and movement of the slab to the freelist.

	It is logical that on a freq alloc/free/alloc repeated sequences that a
	reasonable time has NOT passed and the drain_freelist() will release
	a slab that would be re-used for the next alloc.

	Secondly, if and when CERTAIN events are pending (ie: extremely low  
free memory)
	then the time since should be ignored and all available free slabs  
should be
	re-used / slab_destroy().

	Suggested something like code:

	To add flexibility : add a /proc variable for "X time"
	OR
	#define   FREE_SLAB_AFTER 10	/*secs */

	Thus ..

		in struct slab : add an entry : unsigned long went_free;   /* time  
slab went free */
		Use ALSO as last object inuse changes
		

	drain_freelist():

		Add a boolean arg to drain_freelist() FREE_SOME_EMPTYS or  
FREE_ALL_EMPTYS
		and FUNCTION_CALLERS
		and convert the tofree to the boolean
	
		
		/* After X secs have passed or FREE_ALL_EMPTYS, then destroy/re-use */
		if (  (! (time_after(jiffies, slabp->went_free ) &&  
(FREE_SOME_EMPTYS)))
		    continue;


	TODO:   set jiffy time ONLY when it when it changes  (slabp->inuse =  
0;) and ++ / --
		       slabp->went_free = jiffies;
		alloc_slabmgt();
		slab_get_object();
		slab_put_object();


	/* By adding a jiffies slab struct item */
	/* Adding debug set of the jiffies anytime the SLAB is accessed and a  
like drain
		function looking for leaks say every hour could be done.
	Locating these slabs could then SET WARNings, as it indicates a  
MEMORY LEAK?
	Could be done in check_slabp for age greater than 1 hr

	and s_show() can print the age of the slab .. convert jiffies...
	SHOWS age and last usage..

	Mitchell Erblich
	



	
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ