What does it mean for /proc/kpagecount to be zero
for some entries in /proc/kpagecount, all the 64 bit entry is zeros and yet the page is allocated (confirmed from /proc/kpageflags). What does it mean for kpagecount to be zero for certain physical pages? does that mean that a daemon process is using this memory?
kernel ram proc
add a comment |
for some entries in /proc/kpagecount, all the 64 bit entry is zeros and yet the page is allocated (confirmed from /proc/kpageflags). What does it mean for kpagecount to be zero for certain physical pages? does that mean that a daemon process is using this memory?
kernel ram proc
add a comment |
for some entries in /proc/kpagecount, all the 64 bit entry is zeros and yet the page is allocated (confirmed from /proc/kpageflags). What does it mean for kpagecount to be zero for certain physical pages? does that mean that a daemon process is using this memory?
kernel ram proc
for some entries in /proc/kpagecount, all the 64 bit entry is zeros and yet the page is allocated (confirmed from /proc/kpageflags). What does it mean for kpagecount to be zero for certain physical pages? does that mean that a daemon process is using this memory?
kernel ram proc
kernel ram proc
asked Nov 13 '14 at 22:16
KeetoKeeto
1084
1084
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
proc/kpagecount is a virtual file, when you read it, you get the result of executing function kpagecound_read().
static ssize_t kpagecount_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// ....
u64 pcount;
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
return -EINVAL;
while (count > 0) {
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
else
ppage = NULL;
if (!ppage || PageSlab(ppage) || page_has_type(ppage))
pcount = 0;
else
pcount = page_mapcount(ppage);
if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}
pfn++;
out++;
count -= KPMSIZE;
cond_resched();
}
// ...
}
and page_has_type() is.
static inline int page_has_type(struct page *page)
{
return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
}
If the entry for a page is zero in kpagecount and is allocated, it means:
- It is used in slabs.
page->page_type < PAGE_MAPCOUNT_RESERVEsee patch :return 0 for special pages that are never mapped. This patch is quite new. Consider when this question is asked, I don't think it's the case.
page_mapcount(page)returns zero. some page are allocated but not mapped.
I'am not sure why. Anyway, you can write kernel module/code that allocate page without create a mapping.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f549383%2fwhat-does-it-mean-for-proc-kpagecount-to-be-zero%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
proc/kpagecount is a virtual file, when you read it, you get the result of executing function kpagecound_read().
static ssize_t kpagecount_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// ....
u64 pcount;
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
return -EINVAL;
while (count > 0) {
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
else
ppage = NULL;
if (!ppage || PageSlab(ppage) || page_has_type(ppage))
pcount = 0;
else
pcount = page_mapcount(ppage);
if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}
pfn++;
out++;
count -= KPMSIZE;
cond_resched();
}
// ...
}
and page_has_type() is.
static inline int page_has_type(struct page *page)
{
return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
}
If the entry for a page is zero in kpagecount and is allocated, it means:
- It is used in slabs.
page->page_type < PAGE_MAPCOUNT_RESERVEsee patch :return 0 for special pages that are never mapped. This patch is quite new. Consider when this question is asked, I don't think it's the case.
page_mapcount(page)returns zero. some page are allocated but not mapped.
I'am not sure why. Anyway, you can write kernel module/code that allocate page without create a mapping.
add a comment |
proc/kpagecount is a virtual file, when you read it, you get the result of executing function kpagecound_read().
static ssize_t kpagecount_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// ....
u64 pcount;
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
return -EINVAL;
while (count > 0) {
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
else
ppage = NULL;
if (!ppage || PageSlab(ppage) || page_has_type(ppage))
pcount = 0;
else
pcount = page_mapcount(ppage);
if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}
pfn++;
out++;
count -= KPMSIZE;
cond_resched();
}
// ...
}
and page_has_type() is.
static inline int page_has_type(struct page *page)
{
return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
}
If the entry for a page is zero in kpagecount and is allocated, it means:
- It is used in slabs.
page->page_type < PAGE_MAPCOUNT_RESERVEsee patch :return 0 for special pages that are never mapped. This patch is quite new. Consider when this question is asked, I don't think it's the case.
page_mapcount(page)returns zero. some page are allocated but not mapped.
I'am not sure why. Anyway, you can write kernel module/code that allocate page without create a mapping.
add a comment |
proc/kpagecount is a virtual file, when you read it, you get the result of executing function kpagecound_read().
static ssize_t kpagecount_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// ....
u64 pcount;
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
return -EINVAL;
while (count > 0) {
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
else
ppage = NULL;
if (!ppage || PageSlab(ppage) || page_has_type(ppage))
pcount = 0;
else
pcount = page_mapcount(ppage);
if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}
pfn++;
out++;
count -= KPMSIZE;
cond_resched();
}
// ...
}
and page_has_type() is.
static inline int page_has_type(struct page *page)
{
return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
}
If the entry for a page is zero in kpagecount and is allocated, it means:
- It is used in slabs.
page->page_type < PAGE_MAPCOUNT_RESERVEsee patch :return 0 for special pages that are never mapped. This patch is quite new. Consider when this question is asked, I don't think it's the case.
page_mapcount(page)returns zero. some page are allocated but not mapped.
I'am not sure why. Anyway, you can write kernel module/code that allocate page without create a mapping.
proc/kpagecount is a virtual file, when you read it, you get the result of executing function kpagecound_read().
static ssize_t kpagecount_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// ....
u64 pcount;
pfn = src / KPMSIZE;
count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
if (src & KPMMASK || count & KPMMASK)
return -EINVAL;
while (count > 0) {
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
else
ppage = NULL;
if (!ppage || PageSlab(ppage) || page_has_type(ppage))
pcount = 0;
else
pcount = page_mapcount(ppage);
if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}
pfn++;
out++;
count -= KPMSIZE;
cond_resched();
}
// ...
}
and page_has_type() is.
static inline int page_has_type(struct page *page)
{
return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
}
If the entry for a page is zero in kpagecount and is allocated, it means:
- It is used in slabs.
page->page_type < PAGE_MAPCOUNT_RESERVEsee patch :return 0 for special pages that are never mapped. This patch is quite new. Consider when this question is asked, I don't think it's the case.
page_mapcount(page)returns zero. some page are allocated but not mapped.
I'am not sure why. Anyway, you can write kernel module/code that allocate page without create a mapping.
answered Jan 16 at 5:59
reverielreveriel
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f549383%2fwhat-does-it-mean-for-proc-kpagecount-to-be-zero%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown