Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1964463ybz; Thu, 23 Apr 2020 09:09:34 -0700 (PDT) X-Google-Smtp-Source: APiQypLw2wkprKVlyORlFV3ndhmTeOUNKVxtGW5KQS59OzVEt8R1Z04T/mwm0FcwcEMHJC2nFW4R X-Received: by 2002:a17:907:7211:: with SMTP id dr17mr3209495ejc.296.1587658174083; Thu, 23 Apr 2020 09:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587658174; cv=none; d=google.com; s=arc-20160816; b=VY85q8z2yPwecY9tIcgl+O/9+8uB/Ul/B/8SWrQK9n5eBur+O0Omc/2bcBRp7wmIOd e7bB2grwL4UZkBvB8G2t9D0HMKqNpku/LKR8FVbdPhQ3IzjzRE2ZKnKUKyp/aTZE0Yt9 1MYq6H0ug5QOoZ/aD/wd4fQDkws9fvqYL/ubRhwoQMwh05x5NcJ+G3qBuRc3UM4iGN5H RKrSrIp6ZfisTdd9Jjsq2KZbS/AQQRYjSxHp8PKGqGura1xfSh2zUf9vSzyE8jPo/xTI iKnMPKaE36PjMyqioX+16PC4kIsCjJiCjly3JztuMFzH8uK8KxfulYC4xtq6Jk0ZsVCs 10Dg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o8NjJ+ZRGAsBwuc2VNRIDdFrU8QYsgC6lWkhEP4DRqM=; b=Kl9flUnoBmu8jYwTjUlmdQ/FCYUsA7ST4BZOTwVBqDRQx2NG7MRz348lxFRwbEnT32 OMm6sFI50Tvv1G4rOzskUK6kASrAqfEpXkYoo+AoXfJaR8mTW9BYR2P3qHDXKVENcqN1 cweqlzZptN7qxTanKJERwAPRCntUTkPLtrVZ7aL/arSdTnW28QLCoV8vg0sxqJdbRnUv KRoGe/ZZdxWGRwxN08MXvQcWG6ubhz1tNl4I1+lDwsFif51/XO1KtwpJzlQhcaDOW/9B SnbGZq0YtnKRqp61JmTRnyOiwDscvDILukQTxvQ2VJvKmt3nBB+T4w7arRUrUWu3JXAh eC7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=nUpMcdC5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q20si1471881edb.36.2020.04.23.09.09.00; Thu, 23 Apr 2020 09:09:34 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=nUpMcdC5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729512AbgDWQFu (ORCPT + 99 others); Thu, 23 Apr 2020 12:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729405AbgDWQFt (ORCPT ); Thu, 23 Apr 2020 12:05:49 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4C01C09B040 for ; Thu, 23 Apr 2020 09:05:48 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id 71so5252890qtc.12 for ; Thu, 23 Apr 2020 09:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=o8NjJ+ZRGAsBwuc2VNRIDdFrU8QYsgC6lWkhEP4DRqM=; b=nUpMcdC5tph7V7/hLjokgO8v0xhUSr01BOjkdxf5RmqOQms9brCIntaSQjPKdrCQxh STCb9TFMF7zcBJFU7FPkGp/AnMSTBTnA+UvpxPN8Hr9On8AVnMsw/h7xmJKtO7G1Le6b djXqahTH57hxMYNwKcl4QeJtDIxOkXM31eRtr7U90oE4Mof6bMPidWgB1fFDDH4O+W5y S08qMc3PF05KcZ4PfmP6aRQOPeK6yLXhmo5jUcvMLbfvL3VbT2QttdEcEiMqkH5te1cm 0lIwzM+iCv1abdCvh1/udnvoGSOAPpVnWpDtdrqr3XU/My087wIBAcgfrlqnHt+yH5au bKqw== 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:content-transfer-encoding :in-reply-to; bh=o8NjJ+ZRGAsBwuc2VNRIDdFrU8QYsgC6lWkhEP4DRqM=; b=SL9kxYKhIwf8IwAgNnGnWOcdUMJDVZaU79f6Nf1jQ4XHATBvVkU4MCHjoPHuXrQrjl O+xdBFGUds9YkAMDQjr2/0h+ssdr3ejYKsqeTvXQO/uEsSSpdrMUkRezbrcuQJRlxT5f ag40V1k8mljfMA7hEecqm2AD+rG95SeMjfS8JOZI7s5NWEFPJojdm+IypUgpeWfTuaX+ Ff8OitVBsJEhjf91SVb8V/dqokSYCcv91O9pxp4fC3Wdxwpyo1kmXk5sw2onU96BOJkR BTA7lKR/1BkB2MNn1p+Mq3OX0W5DirOgISG3JUSTBXiQvdYZR+32fqgWstQ/io2+Zi5p SVwg== X-Gm-Message-State: AGi0Puaonxy0ZjEHA3qykADTbK4ALe/A9097K1HxjbV5hyGoJ0GRdkk8 HV6aV9ccDi3w0aerOj1qmP5QnQ== X-Received: by 2002:aed:3aa3:: with SMTP id o32mr4848669qte.364.1587657947786; Thu, 23 Apr 2020 09:05:47 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::921]) by smtp.gmail.com with ESMTPSA id 63sm1759922qkl.64.2020.04.23.09.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 09:05:47 -0700 (PDT) Date: Thu, 23 Apr 2020 12:05:46 -0400 From: Johannes Weiner To: Jaewon Kim Cc: minchan@kernel.org, mgorman@suse.de, m.szyprowski@samsung.com, mina86@mina86.com, shli@fb.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, ytk.lee@samsung.com Subject: Re: [PATCH v2] mm/vmscan: count layzfree pages and fix nr_isolated_* mismatch Message-ID: <20200423160546.GA389168@cmpxchg.org> References: <20200422084815.21913-1-jaewon31.kim@samsung.com> <20200422130751.GD358439@cmpxchg.org> <5EA10872.3010500@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5EA10872.3010500@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 23, 2020 at 12:16:02PM +0900, Jaewon Kim wrote: > > > On 2020년 04월 22일 22:07, Johannes Weiner wrote: > > On Wed, Apr 22, 2020 at 05:48:15PM +0900, Jaewon Kim wrote: > >> @@ -1295,11 +1295,15 @@ static unsigned long shrink_page_list(struct list_head *page_list, > >> */ > >> if (page_mapped(page)) { > >> enum ttu_flags flags = ttu_flags | TTU_BATCH_FLUSH; > >> + bool lazyfree = PageAnon(page) && !PageSwapBacked(page); > >> > >> if (unlikely(PageTransHuge(page))) > >> flags |= TTU_SPLIT_HUGE_PMD; > >> + > >> if (!try_to_unmap(page, flags)) { > >> stat->nr_unmap_fail += nr_pages; > >> + if (lazyfree && PageSwapBacked(page)) > > This looks pretty strange, until you remember that try_to_unmap() > > could SetPageSwapbacked again. > > > > This might be more obvious? > > > > was_swapbacked = PageSwapBacked(page); > > if (!try_to_unmap(page, flags)) { > > stat->nr_unmap_fail += nr_pages; > > if (!was_swapbacked && PageSwapBacked(page)) > Hello Johannes, thank you for your comment. > > The name can changed from layzyfree to was_swapbacked. > By the way, did you mean removing PageAnon(page), too? It seems to be OK, though. I can't decide whether PageAnon() makes it clearer or not. But it's not really needed for correctness. So feel free to keep what you had. I would really just at least change bool lazyfree to was_lazyfree, otherwise it seems a bit confusing. was_lazyfree makes it a bit clearer that we expect try_to_unmap() might change the state. > >> + stat->nr_lazyfree_fail += nr_pages; > >> goto activate_locked; > > Or at least was_lazyfree. > Sorry but I'm confused. > I think you meant additional comment to previous your comment > rather than you wanted to rename stat->nr_lazyfree_fail to stat->was_lazyfree. No just the bool variable, the stat one seems fine to me. > >> @@ -1491,8 +1495,8 @@ unsigned long reclaim_clean_pages_from_list(struct zone *zone, > >> .priority = DEF_PRIORITY, > >> .may_unmap = 1, > >> }; > >> - struct reclaim_stat dummy_stat; > >> - unsigned long ret; > >> + struct reclaim_stat stat; > >> + unsigned long reclaimed; > > nr_reclaimed would be better. > I will add nr_ prefix on next patch. Thanks! > > I also prefer keeping dummy_stat, since that's still what it is. > This patch uses stat.nr_lazyfree_fail, I do not understand why it is still dummy_stat. > If you want, I will keep dummy_stat, though. My bad, I just misread this. 'stat' makes more sense then.