From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by kanga.kvack.org (Postfix) with ESMTP id 3D12B6B0069 for ; Thu, 27 Nov 2014 09:47:28 -0500 (EST) Received: by mail-wi0-f172.google.com with SMTP id n3so15958397wiv.11 for ; Thu, 27 Nov 2014 06:47:27 -0800 (PST) Received: from mx2.suse.de (cantor2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id j9si12420198wjf.10.2014.11.27.06.47.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Nov 2014 06:47:27 -0800 (PST) Date: Thu, 27 Nov 2014 15:47:25 +0100 From: Michal Hocko Subject: Re: [PATCH v17 1/7] mm: support madvise(MADV_FREE) Message-ID: <20141127144725.GB19157@dhcp22.suse.cz> References: <1413799924-17946-1-git-send-email-minchan@kernel.org> <1413799924-17946-2-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1413799924-17946-2-git-send-email-minchan@kernel.org> Sender: owner-linux-mm@kvack.org List-ID: To: Minchan Kim Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michael Kerrisk , linux-api@vger.kernel.org, Hugh Dickins , Johannes Weiner , Rik van Riel , KOSAKI Motohiro , Mel Gorman , Jason Evans , zhangyanfei@cn.fujitsu.com, "Kirill A. Shutemov" , "Kirill A. Shutemov" [Late but I didn't get to this soone - I hope this is still up-to-date version] On Mon 20-10-14 19:11:58, Minchan Kim wrote: > Linux doesn't have an ability to free pages lazy while other OS > already have been supported that named by madvise(MADV_FREE). > > The gain is clear that kernel can discard freed pages rather than > swapping out or OOM if memory pressure happens. > > Without memory pressure, freed pages would be reused by userspace > without another additional overhead(ex, page fault + allocation > + zeroing). > > How to work is following as. > > When madvise syscall is called, VM clears dirty bit of ptes of > the range. If memory pressure happens, VM checks dirty bit of > page table and if it found still "clean", it means it's a > "lazyfree pages" so VM could discard the page instead of swapping out. > Once there was store operation for the page before VM peek a page > to reclaim, dirty bit is set so VM can swap out the page instead of > discarding. Is there any patch for madvise man page? I guess the semantic will be same/similar to FreeBSD: http://www.freebsd.org/cgi/man.cgi?query=madvise&sektion=2 I guess the changelog should be more specific that this is only for the private MAP_ANON mappings (same applies to the patch for man). > Firstly, heavy users would be general allocators(ex, jemalloc, > tcmalloc and hope glibc supports it) and jemalloc/tcmalloc already > have supported the feature for other OS(ex, FreeBSD) > [...] > > Cc: Michael Kerrisk > Cc: Linux API > Cc: Hugh Dickins > Cc: Johannes Weiner > Cc: KOSAKI Motohiro > Cc: Mel Gorman > Cc: Jason Evans > Acked-by: Kirill A. Shutemov > Acked-by: Zhang Yanfei > Acked-by: Rik van Riel > Signed-off-by: Minchan Kim Reviewed-by: Michal Hocko [...] -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org