Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933130AbbHKXlh (ORCPT ); Tue, 11 Aug 2015 19:41:37 -0400 Received: from www.sr71.net ([198.145.64.142]:49847 "EHLO blackbird.sr71.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932485AbbHKXlg (ORCPT ); Tue, 11 Aug 2015 19:41:36 -0400 Message-ID: <55CA882F.3030403@sr71.net> Date: Tue, 11 Aug 2015 16:41:35 -0700 From: Dave Hansen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: vinayakm.list@gmail.com, gregkh@linuxfoundation.org, arve@android.com, akpm@linux-foundation.org CC: linux-kernel@vger.kernel.org, "Wood, Brian J" Subject: Re: [PATCH v3] staging: android: lowmemorykiller: neglect swap cached pages in other_file References: <1393441582-3730-1-git-send-email-vinayakm.list@gmail.com> In-Reply-To: <1393441582-3730-1-git-send-email-vinayakm.list@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1927 Lines: 41 On 02/26/2014 11:06 AM, vinayakm.list@gmail.com wrote: > With ZRAM enabled it is observed that lowmemory killer > doesn't trigger properly. swap cached pages are > accounted in NR_FILE, and lowmemorykiller considers > this as reclaimable and adds to other_file. But these > pages can't be reclaimed unless lowmemorykiller triggers. > So subtract swap pages from other_file. ... > --- a/drivers/staging/android/lowmemorykiller.c > +++ b/drivers/staging/android/lowmemorykiller.c > @@ -88,7 +88,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) > int array_size = ARRAY_SIZE(lowmem_adj); > int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages; > int other_file = global_page_state(NR_FILE_PAGES) - > - global_page_state(NR_SHMEM); > + global_page_state(NR_SHMEM) - > + total_swapcache_pages(); Sorry to dredge up an ancient thread. But, I'm not sure this is a good commit The swap cache is there for pages which are still in RAM but are also in some stage of being written to disk. In this case, the "disk" in question is ZRAM. So, pages in the swap cache are probably "present" simultaneously in the swap cache (the original copy) *and* in ZRAM (the compressed copy). Swap cache pages *do* become reclaimable once their write to the backing store is complete (just like any other dirty data). I assume that this patch did *some* good, but perhaps it was via another mechanism that what was described in the commit message. Or, perhaps the fact that ZRAM consumes RAM has thrown the lowmemorykiller off somehow, and this helps to compensate for that effect. Vinayak, how have you seen this patch help? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/