kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Won-Kyo Choe <wkyo.choe@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: How to handle page allocation when memory exceeds a local node
Date: Thu, 22 Aug 2019 17:41:22 +0900	[thread overview]
Message-ID: <20190822084121.GA26988@swarm01.ajou.ac.kr> (raw)

Suppose that there are two nodes and each node has 16GiB memory size.

When a process needs pages from the kernel, I understand that
__alloc_pages_nodemask() will do allocation for the process.

In the function, I noticed that if there is no available page on
a zone (or a node) while it loops for_next_zone_zonelist_nodemask()
(a macro in get_page_from_freelist()), the kernel would try to reclaim
reclaimable page from the zone. This loops will continue until the
kernel gets a free page. This means that the kernel would try to find a
page from the remote node if there is no free page in the local node.

My question is that when the kernel starts to allocate a page from the
remote node due to no enough memory in the local node, does the kernel
always check there is a reclaimable page from the local node?
In other words, does the kernel always start to find a page from the
very first entry (which would be the local node and the first zone)
in the loop?

In my perspective, if the kernel starts to allocate in the remote node,
I think the scheduler should move the process to the remote node and it
will allocate a page in the remote node at first in the loop (in the
process view, the node would be the local now since it is moved). Would
the scheduler do that?


Regards,
WK Choe


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

             reply	other threads:[~2019-08-22  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  8:41 Won-Kyo Choe [this message]
2019-08-22 10:00 ` How to handle page allocation when memory exceeds a local node Valdis Klētnieks
2019-08-22 10:40   ` Won-Kyo Choe

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=20190822084121.GA26988@swarm01.ajou.ac.kr \
    --to=wkyo.choe@gmail.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).