Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp328246imu; Mon, 5 Nov 2018 01:22:00 -0800 (PST) X-Google-Smtp-Source: AJdET5eIixDEIFjOeymTeQTurkUZtXY3a0Lt5GASgSBcD8Q7yQobNnDnLqakXlNXxHwTFz7dAL// X-Received: by 2002:a62:ee03:: with SMTP id e3-v6mr21849276pfi.2.1541409720024; Mon, 05 Nov 2018 01:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409719; cv=none; d=google.com; s=arc-20160816; b=yyBC0cY58ezr+2aOM6wx/YQWeQM2TBJTALKuCYBknztmjR5X8VY8zPgOLZci9L+n8R JtAyV3MEjF93qFKJeo4NuwwCgHoDm93e2F8tos8xqotMgsFEJ9oezpBlrl42/vq7JD/e FSASgHWf1rnaYQ9+rs1ajUI8KmwlU/Bi+I55PkJkyjsiNQBFdWd6a1NaJ4WIVtVeeq4k BRC3e8CKfFbkvegAniGdD4y7tpZ0dXiKMlyiB9V1HIN4YLHcc2I2p9+Vj+pMpsrSlhRD qngnlviwUV2Kb2cSARcjft7bsXuK4j+gv4VjBO2HaZtdzm+b2xOkj+XksdKgjO+6Y1Qy 22jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=U0aF/bt/WKOTvRzMNdSP4llh9fvOWZYbgGZBi4qNnSg=; b=lCfp3WDtu6Sp8UPNKDeCyGBSInsiJf7bFa8+cDm8dJZBjIWc6YXlNzK/JZK4LtOSDv rT3XAig1qxdDvojJzdJOoAad0DcXpvH4bpCZHhHez1GyH6Rx5EYs9VTn+Gd1CTwk2PMs 6YOwqenRuCDX8EbAExNch4LUlQqlKFmgXbKVMzv2QsJxd745CryUlEPeM1vu9KYISY/h 2ksVuyZC36sU21b4lKMvsxWfSRtHsN3aPQlX9tflM3XVz3wGQ9a3h2/nFE5ZaDBdDyHq ql/Fy6XIvGXb84bhS1qGbMGfjEsdDjGhHDX8OWBzX/cfcKxY5XvuXkHtbqWtKg4B84ZU qz/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si40729164pld.218.2018.11.05.01.21.45; Mon, 05 Nov 2018 01:21:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728930AbeKESkL (ORCPT + 99 others); Mon, 5 Nov 2018 13:40:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:54660 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726125AbeKESkL (ORCPT ); Mon, 5 Nov 2018 13:40:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A5E4BAD70; Mon, 5 Nov 2018 09:21:23 +0000 (UTC) Date: Mon, 5 Nov 2018 10:21:23 +0100 From: Michal Hocko To: Roman Gushchin Cc: Dexuan Cui , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Kernel Team , Shakeel Butt , Johannes Weiner , Tejun Heo , Rik van Riel , Konstantin Khlebnikov , Matthew Wilcox , "Stable@vger.kernel.org" Subject: Re: Will the recent memory leak fixes be backported to longterm kernels? Message-ID: <20181105092053.GC4361@dhcp22.suse.cz> References: <20181102005816.GA10297@tower.DHCP.thefacebook.com> <20181102073009.GP23921@dhcp22.suse.cz> <20181102154844.GA17619@tower.DHCP.thefacebook.com> <20181102161314.GF28039@dhcp22.suse.cz> <20181102162237.GB17619@tower.DHCP.thefacebook.com> <20181102165147.GG28039@dhcp22.suse.cz> <20181102172547.GA19042@tower.DHCP.thefacebook.com> <20181102174823.GI28039@dhcp22.suse.cz> <20181102193827.GA18024@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181102193827.GA18024@castle.DHCP.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 02-11-18 19:38:35, Roman Gushchin wrote: > On Fri, Nov 02, 2018 at 06:48:23PM +0100, Michal Hocko wrote: > > On Fri 02-11-18 17:25:58, Roman Gushchin wrote: > > > On Fri, Nov 02, 2018 at 05:51:47PM +0100, Michal Hocko wrote: > > > > On Fri 02-11-18 16:22:41, Roman Gushchin wrote: > > [...] > > > > > 2) We do forget to scan the last page in the LRU list. So if we ended up with > > > > > 1-page long LRU, it can stay there basically forever. > > > > > > > > Why > > > > /* > > > > * If the cgroup's already been deleted, make sure to > > > > * scrape out the remaining cache. > > > > */ > > > > if (!scan && !mem_cgroup_online(memcg)) > > > > scan = min(size, SWAP_CLUSTER_MAX); > > > > > > > > in get_scan_count doesn't work for that case? > > > > > > No, it doesn't. Let's look at the whole picture: > > > > > > size = lruvec_lru_size(lruvec, lru, sc->reclaim_idx); > > > scan = size >> sc->priority; > > > /* > > > * If the cgroup's already been deleted, make sure to > > > * scrape out the remaining cache. > > > */ > > > if (!scan && !mem_cgroup_online(memcg)) > > > scan = min(size, SWAP_CLUSTER_MAX); > > > > > > If size == 1, scan == 0 => scan = min(1, 32) == 1. > > > And after proportional adjustment we'll have 0. > > > > My friday brain hurst when looking at this but if it doesn't work as > > advertized then it should be fixed. I do not see any of your patches to > > touch this logic so how come it would work after them applied? > > This part works as expected. But the following > scan = div64_u64(scan * fraction[file], denominator); > reliable turns 1 page to scan to 0 pages to scan. OK, 68600f623d69 ("mm: don't miss the last page because of round-off error") sounds like a good and safe stable backport material. -- Michal Hocko SUSE Labs