Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp615452ybf; Wed, 26 Feb 2020 19:40:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyBOmIDSecVzR+LrGFA0SqTLHgU6y6E0LPEMtS0uGgh92HqEsN7iFj3CRwshoEdSq/Wi0fA X-Received: by 2002:a05:6830:1ca:: with SMTP id r10mr1635976ota.319.1582774803796; Wed, 26 Feb 2020 19:40:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582774803; cv=none; d=google.com; s=arc-20160816; b=grmg+5gs4REMWPKOYcZkkSQcdzGG1AwqdoTr4QJTqRw7KXODFiaKjPoaXh/Evv5E5V oP6pn78/7WQNpxI8WJKBQ1A6IVnKJuoJACV8eCdtx4wS4hiHs4g7BYOzvX/A75/SB62C L38tHXzefA85EnFR7vkzhFkphIie4xwARNwi+PKIwO0qH2N1Xodj6yh6aXqAS8054eRb tedOt0ietIAunVIFPlBXY5vN1IVSFpcijaWHIC+QLr+ZfsEsBYdwGTH8SrM//Wjr5MuT nfDF9vnAqBi1PaLlfwV3ggezWrkDE5cC7c3WNQNoi9H+ji/NSGSS5BMoV6VjBmC6brIK yIRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZjaH2Ph/CFJCpX9H/WwI4X1x5GEhmbfGy2UJczHS51k=; b=lrEOnY6X1TFi1gTt7xhQ9NeG30aJZKDooeTOjdme00GknWwcIbLj9LHQSZST2FITv5 AgniaDgZztm8L4GHMCsNygkTwaZ2qM7+fGVbI5rAsk66Vv42KH1TpYOLZwCY9tgFLBbH DKYvJ5I4K5ZEF94GIcP6Jw+RkiAtlaOq+F7TS87qanB4G8Z6tr+LuWbt5gKeFH/6p3TV 2wLUNUOKYro4UBr/H3esayuMkRuyAaVIYcL5xn0s+soGkzMMpShDGPlj4fg5XzZNLp+4 C7TyVp6XDBHtt9ZRw+LAIw9jpEUWZwT5TN8YUYqA7t8ljBnP3rfmKLjVr17yubdaMyX3 Q6ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XMatfAjF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si608864oic.188.2020.02.26.19.39.52; Wed, 26 Feb 2020 19:40:03 -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; dkim=pass header.i=@kernel.org header.s=default header.b=XMatfAjF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728292AbgB0Djp (ORCPT + 99 others); Wed, 26 Feb 2020 22:39:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:51562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728255AbgB0Djp (ORCPT ); Wed, 26 Feb 2020 22:39:45 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA2532467A; Thu, 27 Feb 2020 03:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582774784; bh=9Cffmdd0qW73kmajGjKfvODv6L7Gr3tpz2QX3jQxlFs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XMatfAjFIhOlMtWJ/mHdt/ligz0Nban01KEtDur859vkq2xBkAVBxgCqyxRgurghc qWN2kXNPGUGVbqF4SBHpkPnkRN8ekg8/vcVgXlc/MdtfDwrbGSY9661RsbOCF32fee 4yuJmjNrIfmxWSaggM2O2YPHlsfAZKOc4ihVFE6E= Date: Wed, 26 Feb 2020 19:39:42 -0800 From: Andrew Morton To: js1304@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Hugh Dickins , Minchan Kim , Vlastimil Babka , Mel Gorman , kernel-team@lge.com, Joonsoo Kim Subject: Re: [PATCH v2 0/9] workingset protection/detection on the anonymous LRU list Message-Id: <20200226193942.30049da9c090b466bdc5ec23@linux-foundation.org> In-Reply-To: <1582175513-22601-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1582175513-22601-1-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 20 Feb 2020 14:11:44 +0900 js1304@gmail.com wrote: > From: Joonsoo Kim > > Hello, > > This patchset implements workingset protection and detection on > the anonymous LRU list. The test robot measurement got my attention! http://lkml.kernel.org/r/20200227022905.GH6548@shao2-debian > * Changes on v2 > - fix a critical bug that uses out of index lru list in > workingset_refault() > - fix a bug that reuses the rotate value for previous page > > * SUBJECT > workingset protection > > * PROBLEM > In current implementation, newly created or swap-in anonymous page is > started on the active list. Growing the active list results in rebalancing > active/inactive list so old pages on the active list are demoted to the > inactive list. Hence, hot page on the active list isn't protected at all. > > Following is an example of this situation. > > Assume that 50 hot pages on active list and system can contain total > 100 pages. Numbers denote the number of pages on active/inactive > list (active | inactive). (h) stands for hot pages and (uo) stands for > used-once pages. > > 1. 50 hot pages on active list > 50(h) | 0 > > 2. workload: 50 newly created (used-once) pages > 50(uo) | 50(h) > > 3. workload: another 50 newly created (used-once) pages > 50(uo) | 50(uo), swap-out 50(h) > > As we can see, hot pages are swapped-out and it would cause swap-in later. > > * SOLUTION > Since this is what we want to avoid, this patchset implements workingset > protection. Like as the file LRU list, newly created or swap-in anonymous > page is started on the inactive list. Also, like as the file LRU list, > if enough reference happens, the page will be promoted. This simple > modification changes the above example as following. One wonders why on earth we weren't doing these things in the first place? > * SUBJECT > workingset detection It sounds like the above simple aging changes provide most of the improvement, and that the workingset changes are less beneficial and a bit more risky/speculative? If so, would it be best for us to concentrate on the aging changes first, let that settle in and spread out and then turn attention to the workingset changes?