Skip to contentSkip to conversation

changing physical page

DISCUSSION yipee 4 participants 10 messages Feb 2, 2006 – Feb 5, 2006

lore
Share & tools
lore

yipee

author
#0 lore raw

Hi,

On a system running without swap, can there be a case in which the kernel decides to move (from one physical page to another) a dynamically-allocated page owned by a user program?

Thanks,
y

#1 lore raw
Quoted 8 lines · yipee

Hi,

On a system running without swap, can there be a case in which the kernel decides to move (from one physical page to another) a dynamically-allocated page owned by a user program?

Thanks,
y

<[email protected]>

I'll bet this is a one-shot-deal so you can tell somebody you posted to the linux-kernel list!

The answer is absolutely, positively, maybe, especially on Tuesdays.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips). Warning : 98.36% of all statistics are fiction.
_
To unsubscribe

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

author
#2 lore raw

linux-os (Dick Johnson <linux-os <at> analogic.com> writes:

[snip]

Quoted 2 lines

I'll bet this is a one-shot-deal so you can tell somebody you posted to the linux-kernel list!

nope

Quoted 2 lines

The answer is absolutely, positively, maybe, especially on Tuesdays.

why would the kernel memcpy an allocated page to a different physical location?

Quoted 3 lines

Cheers,
Dick Johnson

y'r name fits

#3 lore raw
In reply to linux-os (Dick Johnson)
Quoted 11 lines · Richard B. Johnson
Quoted 8 lines · yipee

Hi,

On a system running without swap, can there be a case in which the kernel decides to move (from one physical page to another) a dynamically-allocated page owned by a user program?

Thanks,
y

Quoted 7 lines

<[email protected]>

I'll bet this is a one-shot-deal so you can tell somebody you posted to the linux-kernel list!

The answer is absolutely, positively, maybe, especially on Tuesdays.

I got the previous reply but accidentially deleted it. The kernel may try to create some contiguous pages for DMA or other usage. If some page in your task can be switched to make that continuous allocation, it might be.

If your program(s) rely upon being in some physical location, they are broken. Even with mlockall(), you just keep them where they are, not where you'd like them to be. If you are trying to DMA into/out-of user-space, there is only ONE way to do it. Your driver allocates DMA-able pages and your code mmaps() it into user-space. That way, the page(s) are always present and have the right attributes. If you malloc() something, then try to "convert" in the kernel through your driver, the code's broken.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips). Warning : 98.36% of all statistics are fiction.
_
To unsubscribe

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

#5 lore raw
In reply to yipee
Quoted 4 lines · yipee

On a system running without swap, can there be a case in which the kernel decides to move (from one physical page to another) a dynamically-allocated page owned by a user program?

I'll assume that when you say "page owned by a user program", you're meaning a private page, not a shared file page mapped into the program.

If you're asking about what currently happens, the answer is "No".

If you're asking about what you can assume, the answer is "Yes".

The kernel is entitled to move them if it wishes, various people are interested in page migration, and one application would be if the system is short of free memory of a particular kind, and your page is on such memory, and it would help to move it elsewhere.

Hugh

author
#4 lore raw
In reply to linux-os (Dick Johnson)

linux-os (Dick Johnson <linux-os <at> analogic.com> writes:

[snip]

Quoted 9 lines

If your program(s) rely upon being in some physical location, they are broken. Even with mlockall(), you just keep them where they are, not where you'd like them to be. If you are trying to DMA into/out-of user-space, there is only ONE way to do it. Your driver allocates DMA-able pages and your code mmaps() it into user-space. That way, the page(s) are always present and have the right attributes. If you malloc() something, then try to "convert" in the kernel through your driver, the code's broken.

And all this page-moving for getting contiguous DMA memory, happens today on x86_64 kernels?
Can you please give me a pointer to the source code?

Thanks

author
#6 lore raw
In reply to Hugh Dickins

Hugh Dickins <hugh <at> veritas.com> writes:

[snip]

Quoted 6 lines

I'll assume that when you say "page owned by a user program", you're meaning a private page, not a shared file page mapped into the program.

If you're asking about what currently happens, the answer is "No".

If you're asking about what you can assume, the answer is "Yes".

So you are saying that the current kernel doesn't move these kind of pages? but it may in future versions?

thanks,
y

#7 lore raw
Quoted 9 lines · yipee
Quoted 6 lines · Hugh Dickins <hugh <at> veritas.com> writes:

I'll assume that when you say "page owned by a user program", you're meaning a private page, not a shared file page mapped into the program.

If you're asking about what currently happens, the answer is "No".

If you're asking about what you can assume, the answer is "Yes".

So you are saying that the current kernel doesn't move these kind of pages?

If you don't have swap (one of the conditions you gave), yes.

Quoted 1 line

but it may in future versions?

Yes.

#8 lore raw
Quoted 5 lines · Hugh Dickins
Quoted 4 lines · yipee
Quoted 3 lines · Hugh Dickins <hugh <at> veritas.com> writes:

I'll assume that when you say "page owned by a user program", you're meaning a private page, not a shared file page mapped into the program.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

If you're asking about what currently happens, the answer is "No".

If you're asking about what you can assume, the answer is "Yes".

So you are saying that the current kernel doesn't move these kind of pages?

If you don't have swap (one of the conditions you gave), yes.

And what if application forks and writes to the private page? Kernel actually memcpy the page to another location.

--
Gleb.

#9 lore raw
Quoted 8 lines · Gleb Natapov
Quoted 7 lines · Hugh Dickins
Quoted 6 lines · yipee
Quoted 5 lines · Hugh Dickins <hugh <at> veritas.com> writes:

I'll assume that when you say "page owned by a user program", you're meaning a private page, not a shared file page mapped into the program.

If you're asking about what currently happens, the answer is "No".

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

If you're asking about what you can assume, the answer is "Yes".

So you are saying that the current kernel doesn't move these kind of pages?

If you don't have swap (one of the conditions you gave), yes.

And what if application forks and writes to the private page? Kernel actually memcpy the page to another location.

Good point.
Hugh