Re: [RFC Patch] fs: implement per-file drop caches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Thu, 2012-05-31 at 02:30 -0400, KOSAKI Motohiro wrote:
> (5/31/12 2:20 AM), Cong Wang wrote:
> > On Wed, 2012-05-30 at 16:14 +0100, Pádraig Brady wrote:
> >> On 05/30/2012 02:38 PM, Cong Wang wrote:
> >>> This is a draft patch of implementing per-file drop caches.
> >>>
> >>> It introduces a new fcntl command  F_DROP_CACHES to drop
> >>> file caches of a specific file. The reason is that currently
> >>> we only have a system-wide drop caches interface, it could
> >>> cause system-wide performance down if we drop all page caches
> >>> when we actually want to drop the caches of some huge file.
> >>
> >> This is useful functionality.
> >> Though isn't it already provided with POSIX_FADV_DONTNEED?
> >
> > Thanks for teaching this!
> >
> > However, from the source code of madvise_dontneed() it looks like it is
> > using a totally different way to drop page caches, that is to invalidate
> > the page mapping, and trigger a re-mapping of the file pages after a
> > page fault. So, yeah, this could probably drop the page caches too (I am
> > not so sure, haven't checked the code in details), but with my patch, it
> > flushes the page caches directly, what's more, it can also prune
> > dcache/icache of the file.
> 
> madvise should work. I don't think we need duplicate interface. Moreomover
> madvise(2) is cleaner than fcntl(2).
> 

I think madvise(DONTNEED) attacks the problem in a different approach,
it munmaps the file mapping and by the way drops the page caches, my
approach is to drop the page caches directly similar to what sysctl
drop_caches.

What about private file mapping? Could madvise(DONTNEED) drop the page
caches too even when the other process is doing the same private file
mapping? At least my patch could do this.

I am not sure if fcntl() is a good interface either, this is why the
patch is marked as RFC. :-D

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Kbuild]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]