Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
From: "aleix sanchis ramírez" <aleixsanchis@hotmail.com>
To: Sumit Kumar <sumit686215@gmail.com>,
	"kernelnewbies@kernelnewbies.org"
	<kernelnewbies@kernelnewbies.org>
Subject: RE: transfer physical memory page to swap disk
Date: Wed, 15 Jan 2020 12:42:57 +0000
Message-ID: <AM7PR08MB541576DA0F4535FB686E9CB7DB370@AM7PR08MB5415.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <CACFOd6VGhvQ=EfDZyNwP_j-+u51MtwXrvsKnTgXQ0oYXKzKZtQ@mail.gmail.com>

[-- Attachment #1.1: Type: text/plain, Size: 953 bytes --]


> Hi,
>Does C/C++ provide any API / system call that enables user to force the application to transfer some its physical pages to swap disk ? If so, is it also possible to obtain the least used page using some API ?

I don't think such a system call exists. There might be some mechanisms that may cause your memory to be swapped out as a side effect, but I doubt you have much control over which page gets swapped.

> AFAIK, linux kernel is supposed to do this as part of memory management. I want to know if the kernel also exposes some API to enable users to control their application's memory management. I have many applications running at a time that cause too much memory consumption. I believe that experimenting with memory management can help.

I really don't think this kind of management can, or should, be done from user-space. If you have too much memory consumption, try to increase system memory or optimize your applications.

[-- Attachment #1.2: Type: text/html, Size: 1407 bytes --]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div><br>
</div>
<div>&gt; Hi,&nbsp; </div>
<div>
<div>
<div dir="ltr">
<div>&gt;Does C/C&#43;&#43; provide any API / system call that enables user to force the application to transfer some its physical pages to swap disk ? If so, is it also possible to obtain the least used page using some API ?
<br>
</div>
<div><br>
</div>
<div>I don't think such a system call exists. There might be some mechanisms that may cause your memory to be swapped out as a side effect, but I doubt you have much control over which page gets swapped.<br>
</div>
<div><br>
</div>
<div>&gt; AFAIK, linux kernel is supposed to do this as part of memory management. I want to know if the kernel also exposes some API to enable users to control their application's memory management. I have many applications running at a time that cause too much
 memory&nbsp;consumption. I believe that experimenting with memory management can help.</div>
<div><br>
</div>
<div>I really don't think this kind of management can, or should, be done from user-space. If you have too much memory consumption, try to increase system memory or optimize your applications.<br>
</div>
</div>
</div>
</div>
</body>
</html>

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

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

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 12:31 Sumit Kumar
2020-01-15 12:42 ` aleix sanchis ramírez [this message]
2020-01-15 12:53 ` Anupam Kapoor
2020-01-18 15:10   ` Valdis Klētnieks

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:
  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=AM7PR08MB541576DA0F4535FB686E9CB7DB370@AM7PR08MB5415.eurprd08.prod.outlook.com \
    --to=aleixsanchis@hotmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=sumit686215@gmail.com \
    /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

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
	public-inbox-index kernelnewbies

Example config snippet for mirrors

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.git