Skip to contentSkip to conversation

fadvise doesn't work well.

DISCUSSION Simon Jeons 2 participants 5 messages Jan 9, 2013 Memory management

lore
Share & tools
lore
#0 lore raw

In attanchment.

root@kernel:~/Documents/mm/tools/linux-ftools# dd if=../../../images/ubuntu-11.04-desktop-i386.iso of=/tmpfs
1403484+0 records in
1403484+0 records out
718583808 bytes (719 MB) copied, 19.5054 s, 36.8 MB/s
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fadvise ../../../images/ubuntu-11.04-desktop-i386.iso DONTNEED 0,718585856
Going to fadvise ../../../images/ubuntu-11.04-desktop-i386.iso as mode DONTNEED
offset: 0
length: 718583808
Invalid mode DONTNEED
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
#1 lore raw

Hi Simon,

Try run "sync" before doing fadvise, because fadvise won't drop dirty/writeback/mapped pages.

Thanks,
Fengguang

Quoted 15 lines · Simon Jeons

In attanchment.

root@kernel:~/Documents/mm/tools/linux-ftools# dd if=../../../images/ubuntu-11.04-desktop-i386.iso of=/tmpfs
1403484+0 records in
1403484+0 records out
718583808 bytes (719 MB) copied, 19.5054 s, 36.8 MB/s
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fadvise ../../../images/ubuntu-11.04-desktop-i386.iso DONTNEED 0,718585856
Going to fadvise ../../../images/ubuntu-11.04-desktop-i386.iso as mode DONTNEED
offset: 0
Quoted 9 lines
length: 718583808
Invalid mode DONTNEED
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 5 lines · Fengguang Wu

Hi Simon,

Try run "sync" before doing fadvise, because fadvise won't drop dirty/writeback/mapped pages.

Hi Fengguang,

Thanks for your quick response. But the result is the same in attachment.

Quoted 7 lines

Thanks,
Fengguang

Quoted 3 lines · Simon Jeons

In attanchment.

root@kernel:~/Documents/mm/tools/linux-ftools# dd if=../../../images/ubuntu-11.04-desktop-i386.iso of=/tmpfs

The pages of ../../../images/ubuntu-11.04-desktop-i386.iso is mapped or unmapped?

Quoted 13 lines
Quoted 13 lines

1403484+0 records in
1403484+0 records out
718583808 bytes (719 MB) copied, 19.5054 s, 36.8 MB/s

root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fadvise ../../../images/ubuntu-11.04-desktop-i386.iso DONTNEED 0,718585856
Going to fadvise ../../../images/ubuntu-11.04-desktop-i386.iso as mode DONTNEED
offset: 0
length: 718583808
Quoted 9 lines
Quoted 8 lines

Invalid mode DONTNEED

root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso 
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# dd if=../../../images/ubuntu-11.04-desktop-i386.iso of=/tmpfs
1403484+0 records in
1403484+0 records out
718583808 bytes (719 MB) copied, 35.5144 s, 20.2 MB/s
root@hacker:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# sync
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fadvise ../../../images/ubuntu-11.04-desktop-i386.iso DONTNEED 0,718585856
Going to fadvise ../../../images/ubuntu-11.04-desktop-i386.iso as mode DONTNEED
offset: 0
length: 718583808
Invalid mode DONTNEED
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fincore -s ../../../images/ubuntu-11.04-desktop-i386.iso
filename                                                                                       size        total_pages    min_cached page       cached_pages        cached_size        cached_perc
--------                                                                                       ----        -----------    ---------------       ------------        -----------        -----------
../../../images/ubuntu-11.04-desktop-i386.iso                                             718583808             175436                  0             175436          718585856             100.00
---
total cached size: 718585856
#3 lore raw
Quoted 15 lines · Simon Jeons
Quoted 5 lines · Fengguang Wu

Hi Simon,

Try run "sync" before doing fadvise, because fadvise won't drop dirty/writeback/mapped pages.

Hi Fengguang,

Thanks for your quick response. But the result is the same in attachment.

Quoted 3 lines

Thanks,
Fengguang

Quoted 7 lines
Quoted 4 lines · Simon Jeons
Quoted 3 lines

In attanchment.

root@kernel:~/Documents/mm/tools/linux-ftools# dd if=../../../images/ubuntu-11.04-desktop-i386.iso of=/tmpfs

The pages of ../../../images/ubuntu-11.04-desktop-i386.iso is mapped or unmapped?

You may check if anyone is using (hence possibly mapping) it with

        lsof | grep ubuntu-11.04-desktop-i386.iso

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
In reply to Simon Jeons
Quoted 5 lines
root@kernel:~/Documents/mm/tools/linux-ftools# ./linux-fadvise ../../../images/ubuntu-11.04-desktop-i386.iso DONTNEED 0,718585856
Going to fadvise ../../../images/ubuntu-11.04-desktop-i386.iso as mode DONTNEED
offset: 0
length: 718583808
Invalid mode DONTNEED

~~~~~~~~~~~~~~~~~~~~~~~

Oops, that's invalid command. Use "dontneed" rather than "DONTNEED".

fadvise is case sensitive..

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>