kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Colin Hamilton <colin.hamilton@suse.com>
To: kernelnewbies@kernelnewbies.org
Subject: __vm_enough_memory calculation when deactivating a swap device
Date: Sun, 30 Jun 2019 13:57:27 -0600 (MDT)	[thread overview]
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, 
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

                 reply	other threads:[~2019-06-30 19:58 UTC|newest]

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

Reply instructions:

You may reply publicly 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* 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 \
    --to=colin.hamilton@suse.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).