From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE02C54FD0 for ; Thu, 23 Apr 2020 16:05:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 603C520728 for ; Thu, 23 Apr 2020 16:05:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="nUpMcdC5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 603C520728 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EDDEB8E0005; Thu, 23 Apr 2020 12:05:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8DE88E0003; Thu, 23 Apr 2020 12:05:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA3098E0005; Thu, 23 Apr 2020 12:05:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id C03828E0003 for ; Thu, 23 Apr 2020 12:05:49 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 80DD9824805A for ; Thu, 23 Apr 2020 16:05:49 +0000 (UTC) X-FDA: 76739595618.04.oil31_8a119e696e731 X-HE-Tag: oil31_8a119e696e731 X-Filterd-Recvd-Size: 5885 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 23 Apr 2020 16:05:48 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id 92so5306029qtg.0 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=qD84tz5bN7ovedkFqfG7ce532Ryv3C6etVBc7vx7JpNylha8L0+N2k1waElIt5oyyH dPDk47zInIEG76cM7ZhJSfKGDSgqRAsG2ojsGepLK/vE6K5Q1UsYvywZ1fajLaZYKdES DhNBXRJoZSe0gHeE7jS/qfoom9eRa8B4L4tf4dPa03vRhgAefZEqvJILq670iOwAWeVx 649/GaXvZX8RnKeM5cb1YAbdGOLM0jEcqIttldsvrTbWrXXke7+6r9o3uEsgw8kZWH9X y7rIKAacM8vULSa8U0qeYunjiomqVHdP55jtIb9FJm+NpLRdgQ7yH6PdPfEdLDf5yGb/ fvIQ== X-Gm-Message-State: AGi0Pua8bxC2eeK+a2ZvHk2qLdTf3/tPsjlSwvjIokwDGoBbujj/3pUB RGERhY6OtjQNtNcCMbWdHPz/wQ== X-Google-Smtp-Source: APiQypIWI+qTohLBPVldLUX02lOsPfHAp5mdWRH+VnhUfYHdm8z4Bw7WAdO2HarO/mORZ3HZb3txdg== 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 In-Reply-To: <5EA10872.3010500@samsung.com> Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Apr 23, 2020 at 12:16:02PM +0900, Jaewon Kim wrote: >=20 >=20 > On 2020=EB=85=84 04=EC=9B=94 22=EC=9D=BC 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 =3D ttu_flags | TTU_BATCH_FLUSH; > >> + bool lazyfree =3D PageAnon(page) && !PageSwapBacked(page); > >> =20 > >> if (unlikely(PageTransHuge(page))) > >> flags |=3D TTU_SPLIT_HUGE_PMD; > >> + > >> if (!try_to_unmap(page, flags)) { > >> stat->nr_unmap_fail +=3D 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 =3D PageSwapBacked(page); > > if (!try_to_unmap(page, flags)) { > > stat->nr_unmap_fail +=3D nr_pages; > > if (!was_swapbacked && PageSwapBacked(page)) > Hello Johannes, thank you for your comment. >=20 > The name can changed from layzyfree to was_swapbacked. > By the way, did you mean removing PageAnon(page), too? It seems to be O= K, 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 +=3D 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_la= zyfree. No just the bool variable, the stat one seems fine to me. > >> @@ -1491,8 +1495,8 @@ unsigned long reclaim_clean_pages_from_list(st= ruct zone *zone, > >> .priority =3D DEF_PRIORITY, > >> .may_unmap =3D 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 st= ill dummy_stat. > If you want, I will keep dummy_stat, though. My bad, I just misread this. 'stat' makes more sense then.