Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp282635ybr; Fri, 22 May 2020 06:36:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCTDUWMjIJzifD+qqlgZHFY8aUhqDG3ZyUaDqd7bV/F76Cn66YTqeCx6E7/qq3/VuKfZjX X-Received: by 2002:a17:906:dbc9:: with SMTP id yc9mr8464698ejb.157.1590154564345; Fri, 22 May 2020 06:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590154564; cv=none; d=google.com; s=arc-20160816; b=d/qWTyuFE7Ipn66RLWc9xqsSpyEuxcKxWhuGK1HcekR0N1Sn6hwO6AVSZhiU9X1BJU gXNmEYKrnq1pzi7IdziHP2W7s3dE7LgpP/V2yN9JajskoE3niuajPSRDplOnYtfMisqy idg4eNSd8e7OQdpKaqq3ddj5yBGKIRFNbV1DjFHkGW/+eHscNf5cQgXPjxXAtOl9THk8 gBcUD1WPr5ScXArkc50VbZblB6te5LD72tMNkfIU90Cy2Wv6AnUR3yd7fNnuCVyM/tf5 m++gmRD6NsHz6l9pwQl+gACFBUKw+V3kJVLiXW5hs7LT76ieGaDuXBj/ldMwg7nrMlCW yp5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OJPtBO5fmTTaWhSyWjmcp4bLb1ODXwI1HZb2MVRuSrs=; b=leoGbL9/gfMH1pnaZ37PbiloMekXGnU7/d474XBlr+urudFm4qzsq6vlgH3NJPjuLw Y6rZuhgTP4YEUw2sFVf1U8hFF6i9vmWGAy3dnLqhnEGwOiFITUAe+vJOBq5AWo8rhk5J 7jawz9LeS/PWzX8ZqZFIWTyV9k5gBp4jwyxnbyzKvGl3MynCm7E4vJfEtRbrRJioRvgt OPLZMeXG/XiTHF74jbjH9hF21hPXRqe1/AqTxBeVfvvWERszJAUhwxOR9qIBYJRtBYfA eS/c4Wh+wP1PZX/CE6zOIROvoYSHV5QIIT78ISsryjUJgVh2Q0Iy7QmSnk8zNdHr0FEX HdNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="HO+B/Vs0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a26si4818796ejx.524.2020.05.22.06.35.39; Fri, 22 May 2020 06:36:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b="HO+B/Vs0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730036AbgEVNdo (ORCPT + 99 others); Fri, 22 May 2020 09:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729687AbgEVNdn (ORCPT ); Fri, 22 May 2020 09:33:43 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B80C061A0E for ; Fri, 22 May 2020 06:33:43 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id d1so4696413qvl.6 for ; Fri, 22 May 2020 06:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OJPtBO5fmTTaWhSyWjmcp4bLb1ODXwI1HZb2MVRuSrs=; b=HO+B/Vs0fG0dX2f482MYjKlz50owpKdPJx3oKJmiRRX+4cnEVto2lrMy/dOZhbiifz Ao7g28y88lmaF3/S43LJvmmiPs/V1b17YIJ7uKBLEoF8Q0gPtS5v+xEZ4Nztd8GY6HlQ 19Ikja1eGIQaAf8/uYyCOKFH88kcfrnFCryyBvFr1fzjLjXajckuFD6M0tuKcgu4dssL BZZJNPRYqqhncHrvSjZQ3yjW6c6/t1QkAc5du40LrvudCv5WvNbcJQwFs8unz72RcQLU NtzfEZJ49+gWO/7myExdDPaxENqNboC2D6+w6j0HEjgvtsC29zkhaz61ihb/Rm/89ZZj tVWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OJPtBO5fmTTaWhSyWjmcp4bLb1ODXwI1HZb2MVRuSrs=; b=epHg5tvQ5F8AHnvXTw77KSdW0EszwlPoF74tWFAfHw/qruQhVeEAbEKa/WZIhis0q6 34Us7Q9sZuwT3Fdpur1J+alsMquejegOnFpBL2AhEfwT8qZVtwUwK7dRM0EIglg32SBJ t8oPBLwVt91aO3z2GJxXEvOWxq8VpH03USvQusG5aySjdm+mmk0OFaA4XCkuOdaVpVzB AhE2fk2to8WsKMosTbD0M/pgKtMnBQGsrKOWVNZ0mfXCqrMZp3qq1DnIl0mFcuxf/8Qr cNwTHQLc+Jm4nUDNbpRyAnE9NqQLp+C8V5lB1z3AMM0Thr6RoUtosViVluuDbMd8UTVx 34Mw== X-Gm-Message-State: AOAM5315QOrQsTWaYqMxCRm02/PFjWlR5Q5Ho5mHiGrJla1amlIrQCQQ OiVUZVLA/aVyLmmZ4RSnPCjWDw== X-Received: by 2002:ad4:4690:: with SMTP id bq16mr3655502qvb.20.1590154422147; Fri, 22 May 2020 06:33:42 -0700 (PDT) Received: from Qians-MacBook-Air.local (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id o6sm1325452qtd.59.2020.05.22.06.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 06:33:41 -0700 (PDT) Date: Fri, 22 May 2020 09:33:35 -0400 From: Qian Cai To: Johannes Weiner Cc: linux-mm@kvack.org, Rik van Riel , Minchan Kim , Michal Hocko , Andrew Morton , Joonsoo Kim , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 09/14] mm: deactivations shouldn't bias the LRU balance Message-ID: <20200522133335.GA624@Qians-MacBook-Air.local> References: <20200520232525.798933-1-hannes@cmpxchg.org> <20200520232525.798933-10-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520232525.798933-10-hannes@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 07:25:20PM -0400, Johannes Weiner wrote: > Operations like MADV_FREE, FADV_DONTNEED etc. currently move any > affected active pages to the inactive list to accelerate their reclaim > (good) but also steer page reclaim toward that LRU type, or away from > the other (bad). > > The reason why this is undesirable is that such operations are not > part of the regular page aging cycle, and rather a fluke that doesn't > say much about the remaining pages on that list; they might all be in > heavy use, and once the chunk of easy victims has been purged, the VM > continues to apply elevated pressure on those remaining hot pages. The > other LRU, meanwhile, might have easily reclaimable pages, and there > was never a need to steer away from it in the first place. > > As the previous patch outlined, we should focus on recording actually > observed cost to steer the balance rather than speculating about the > potential value of one LRU list over the other. In that spirit, leave > explicitely deactivated pages to the LRU algorithm to pick up, and let > rotations decide which list is the easiest to reclaim. > > Signed-off-by: Johannes Weiner > Acked-by: Minchan Kim > Acked-by: Michal Hocko > --- > mm/swap.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/mm/swap.c b/mm/swap.c > index 5d62c5a0c651..d7912bfb597f 100644 > --- a/mm/swap.c > +++ b/mm/swap.c > @@ -515,14 +515,12 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, > > if (active) > __count_vm_event(PGDEACTIVATE); > - lru_note_cost(lruvec, !file, hpage_nr_pages(page)); > } > [] mm/swap.c: In function 'lru_deactivate_file_fn': mm/swap.c:504:11: warning: variable 'file' set but not used [-Wunused-but-set-variable] int lru, file; ^~~~ This? diff --git a/mm/swap.c b/mm/swap.c index fedf5847dfdb..9c38c1b545af 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -501,7 +501,7 @@ void lru_cache_add_active_or_unevictable(struct page *page, static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, void *arg) { - int lru, file; + int lru; bool active; if (!PageLRU(page)) @@ -515,7 +515,6 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, return; active = PageActive(page); - file = page_is_file_lru(page); lru = page_lru_base_type(page); del_page_from_lru_list(page, lruvec, lru + active);