Skip to contentSkip to conversation

Best way to extend try_to_free_pages()?

DISCUSSION Rik van Riel 1 participant 1 message May 16, 2000 1 message not in the archive Memory management

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Andreas Bombe

(not possible, since 1394 code can be modularized)? If not, I consider adding some generic code to register callbacks for low memory situations as soon as I need it.

A callback system from do_try_to_free_pages(), where anybody can dynamically register their cache->drop_pages() function would be nice.

Maybe a list of caches with function pointers?

spin_lock(&cachelist_lock);

for (cache = &cachelist.next ; cache->next != &cachelist  ;
			 cache = cachelist->next) {
	count -= cache->drop_pages(priority);
	if (count <= 0)
		break;
}

spin_unlock(&cachelist_lock);

On module load time, init_module() could grab the cachelist_lock, insert an entry in the list and next time try_to_free_pages() is called our cache will be shrunk too.

regards,

Rik
--
The Internet is not a network of computers. It is a network of people. That is its real strength.

Wanna talk about the kernel? irc.openprojects.net / #kernelnewbies
http://www.conectiva.com/ http://www.surriel.com/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/