Kernel Newbies archive on
 help / color / Atom feed
* __vm_enough_memory calculation when deactivating a swap device
@ 2019-06-30 19:57 Colin Hamilton
  0 siblings, 0 replies; only message in thread
From: Colin Hamilton @ 2019-06-30 19:57 UTC (permalink / raw)
  To: kernelnewbies

Hey everyone,

When the sys_swapoff() routine is attempting to deactivate a swap area 
it checks to make sure there is enough free space to swap-in the 
required new page frames from the deactivating swap device. In 
__vm_enough_memory it adds to the free variable counting all currently 
active swap pages, including from the device that is to be deactivated, 

free += get_nr_swap_pages();

My question/confusion is, why doesn't the kernel have code in 
place to exclude free swap pages from the device that is to be 
deactivated when __vm_enough_memory is used for this purpose?

Is it because it would require reworking too much of what approximately 
works now? In other words, is this a cost/benefit decision to not have 
that added logic? Or perhaps I'm just misunderstanding how something is 
supposed to work?


Colin Hamilton <>

Kernelnewbies mailing list

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-30 19:57 __vm_enough_memory calculation when deactivating a swap device Colin Hamilton

Kernel Newbies archive on

Archives are clonable:
	git clone --mirror kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ \
	public-inbox-index kernelnewbies

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox