Kernel Newbies archive on lore.kernel.org
 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, 
with:

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?

Thanks,

--
Colin Hamilton <colin.hamilton@suse.com>
SUSE

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ 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 lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 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/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox