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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 09A05C433E1 for ; Mon, 17 Aug 2020 16:06:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8C1DC2173E for ; Mon, 17 Aug 2020 16:06:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C1DC2173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 273056B0002; Mon, 17 Aug 2020 12:06:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 226836B0005; Mon, 17 Aug 2020 12:06:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 114A06B0006; Mon, 17 Aug 2020 12:06:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id F2AAF6B0002 for ; Mon, 17 Aug 2020 12:06:05 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AD643824556B for ; Mon, 17 Aug 2020 16:06:05 +0000 (UTC) X-FDA: 77160537090.14.stop38_070b84327018 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 2F43D1807F206 for ; Mon, 17 Aug 2020 16:05:55 +0000 (UTC) X-HE-Tag: stop38_070b84327018 X-Filterd-Recvd-Size: 3438 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Aug 2020 16:05:54 +0000 (UTC) IronPort-SDR: dFZufKS6HjvMpyvqr8lT7fKm/FwK8wa2cqxuvjzs7Dxg9RJpL6R1IK4aSraPmQRddHkgzIUzPR 1DtLl1AGqUFw== X-IronPort-AV: E=McAfee;i="6000,8403,9716"; a="134798962" X-IronPort-AV: E=Sophos;i="5.76,324,1592895600"; d="scan'208";a="134798962" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2020 09:05:50 -0700 IronPort-SDR: b8piYg15sWkJ3OMGV0crCNCfJtLE6bGfWamuDGzxHzL2LbpcHrOjtc6g0p6L/SA8rS+G2qAyUx 5PDuvqN25s8g== X-IronPort-AV: E=Sophos;i="5.76,324,1592895600"; d="scan'208";a="440912281" Received: from ahduyck-mobl1.amr.corp.intel.com (HELO [10.251.23.62]) ([10.251.23.62]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2020 09:05:49 -0700 Subject: Re: [PATCH] mm/page_reporting: the "page" must not be the list head To: David Hildenbrand , Wei Yang , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20200817084836.29216-1-richard.weiyang@linux.alibaba.com> From: Alexander Duyck Message-ID: Date: Mon, 17 Aug 2020 09:05:32 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 2F43D1807F206 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/17/2020 2:35 AM, David Hildenbrand wrote: > On 17.08.20 10:48, Wei Yang wrote: >> If "page" is the list head, list_for_each_entry_safe() would stop >> iteration. >> >> Signed-off-by: Wei Yang >> --- >> mm/page_reporting.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/page_reporting.c b/mm/page_reporting.c >> index 3bbd471cfc81..aaaa3605123d 100644 >> --- a/mm/page_reporting.c >> +++ b/mm/page_reporting.c >> @@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, >> * the new head of the free list before we release the >> * zone lock. >> */ >> - if (&page->lru != list && !list_is_first(&page->lru, list)) >> + if (!list_is_first(&page->lru, list)) >> list_rotate_to_front(&page->lru, list); >> >> /* release lock before waiting on report processing */ >> > > Is this a fix or a cleanup? If it's a fix, can this be reproduced easily > and what ere the effects? > This should be a clean-up. Since the &page->lru != list will always be true. If I recall at some point the that was a check for &next->lru != list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.