Kernel Newbies archive on
 help / color / Atom feed
From: Colin Hamilton <>
Subject: __vm_enough_memory calculation when deactivating a swap device
Date: Sun, 30 Jun 2019 13:57:27 -0600 (MDT)
Message-ID: <nycvar.YFH.7.76.1906301343130.9160@yvahk-hern.fhfr> (raw)

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

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YFH.7.76.1906301343130.9160@yvahk-hern.fhfr \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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