Re: [RFC PATCH] mm: thp: make swap configurable

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

 



Hi Bob,

On Tue, Oct 11, 2011 at 05:24:26PM +0800, Bob Liu wrote:
> Thanks for your reply.
> 
> Yes, mlock() can do it but it will require a lot of changes in every
> user application.
> If some of the applications are hugh and complicated(even not opensource), it's
> hard to modify them.
> Add this patch can make things simple and thp more flexible.
> 
> For using swapoff -a, it will disable swap for 4k normal pages.
> 
> A simple use case is like this:
> a lot of swap sensitive apps run on a machine, it will use thp so we
> need to disable swap.
> But  this apps are hugh and complicated, it's hard to modify them by mlock().
> 
> In addition, there are also some normal and not swap sensitive apps
> which don't use thp run on
> the same machine, we can still reclaim their memory by swap when lack
> of memory.

I'm not convinced. If you need to disable swap selectively to certain
apps but you can't modify them I'd suggest to add a
mlock-equal-privileged prctl(PR_SWAP_ENABLE/DISABLE) that applies to
all anonymous memory and tmpfs. Probably not to filebacked memory in
case MAP_SHARED is used for all I/O. This seems too limited, it may
happen to work well for a specific application but it's not generic
enough. Another user could have a binary application with a ton of
tmpfs shared memory that he can't modify (MAP_SHARED on /dev/zero for
example) and he wants to mlock it but he can't. Or maybe another user
has an application with <2M anonymous memory scattered in the middle
of MAP_SHARED segments (so that can't be mapped by THP because of
strict hardware limits) and he wants it to remain locked in ram too
and not be swapped out for that specific app. So I prefer a solution
that threats all anonymous memory and tmpfs memory equal (the only two
entities in the kernel that will be paged out to swap). Or at the very
least all anonymous memory equal... so it remains transparent as much
as possible :).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]