Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp497909pxj; Tue, 18 May 2021 08:03:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUkhe+x+zJPdvKGeZd4JuQV3mmY5GTDRXwmgM6PTYxL9FU8OdcJjRSY2RS6MP4PpStkX1y X-Received: by 2002:a92:4a0e:: with SMTP id m14mr4647806ilf.278.1621350236755; Tue, 18 May 2021 08:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621350236; cv=none; d=google.com; s=arc-20160816; b=ASks/+Sm4jiE0/KVGAKJGOlEjslWPQonAMSxf5vJoSl6hUZgflycvE4IoCANoij8pY SYaz2rWtB49N+OOwZ/IAHRfwHK9+LgSLwGmHJPz00KxX58DRnoS68CLPIEZJ1Jol5mLQ 1TBaJsWCVSgR8/KJe82dFf2B3nXto/WeMMUulsgd4CD5xDAvJdzcmxTsT485Rb1+O10v 4uGjFMKMzG/LtMwTiKulYYykpIXKRVdek2SJyj7LSuoMiAp2VcVToATEORAzG1U1HMKd EzTfLEyp/KNd5/iC8DlTbbZLRRIksjH15ZXW/lKqacchvp3FZRdQ7qbJdFb9EMVupK6T Xvjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MPP9/dSXKkfXKGfw/6zeP78rWfFvvhWHGNlRMDuFvuo=; b=fNI5/Lqzm8eL3PwzTc0s6QzDMYVgqNV38whtK3hNNtu/C7igwIZ39f6+JUB2ZudOUc dqH+TFfdbS3zWtj6BiiKiUaSMAWVZvShm7IZqTnCKQBcOabSF0ZBmAkwwxGf3DjGwb6N vtCEUFttrf2YLFLU8HhToVEUNbzgnuiToEvjjujBiAU4H6aNTYI3z5YQwTYfVrA71DwT lGnCkRHPry+idzfadLV6sq93wcPMm5aKvcofsak//olbcxnS/fT2VLtoOt/9LJGXHGeb n9IwOn7Xf3DrB7c1tZWkR5gcazslhv0GAOUpFyGVT+XS0ubkwKgn7MHNeDlX1sWEZ62J epeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jBidUVXq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h31si23905362jav.116.2021.05.18.08.03.43; Tue, 18 May 2021 08:03:56 -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=@linuxfoundation.org header.s=korg header.b=jBidUVXq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244380AbhEQPu7 (ORCPT + 99 others); Mon, 17 May 2021 11:50:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:38868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242863AbhEQPd6 (ORCPT ); Mon, 17 May 2021 11:33:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 883D661244; Mon, 17 May 2021 14:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262348; bh=zjz52N9srrotdxv3CTc1aPidvSlqo1NXbLmieSeg2dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBidUVXqc+fhCDRfdBCN9Hl3cMkF9EnD19Zt/vUF89lN6sM0Aw23qJsW20Fa9Wk86 HP/LRRO0sCfvwEAe8k1qBpGE5M9iAK3s/q+tJNVXdV1yhjnIMkm/dj1keL7YzhGFyl VHRwjtGgPu+dnLCTvkpGEX/J/l2AmRMWqvAqytLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , "Kirill A. Shutemov" , Dan Carpenter , Ebru Akagunduz , Mike Kravetz , Rik van Riel , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.10 166/289] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate() Date: Mon, 17 May 2021 16:01:31 +0200 Message-Id: <20210517140310.711942416@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaohe Lin [ Upstream commit 74e579bf231a337ab3786d59e64bc94f45ca7b3f ] In writable and !referenced case, the result value should be SCAN_LACK_REFERENCED_PAGE for trace_mm_collapse_huge_page_isolate() instead of default 0 (SCAN_FAIL) here. Link: https://lkml.kernel.org/r/20210306032947.35921-5-linmiaohe@huawei.com Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages") Signed-off-by: Miaohe Lin Acked-by: Kirill A. Shutemov Cc: Dan Carpenter Cc: Ebru Akagunduz Cc: Mike Kravetz Cc: Rik van Riel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/khugepaged.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index abab394c4206..a6238118ac4c 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -714,17 +714,17 @@ next: if (pte_write(pteval)) writable = true; } - if (likely(writable)) { - if (likely(referenced)) { - result = SCAN_SUCCEED; - trace_mm_collapse_huge_page_isolate(page, none_or_zero, - referenced, writable, result); - return 1; - } - } else { + + if (unlikely(!writable)) { result = SCAN_PAGE_RO; + } else if (unlikely(!referenced)) { + result = SCAN_LACK_REFERENCED_PAGE; + } else { + result = SCAN_SUCCEED; + trace_mm_collapse_huge_page_isolate(page, none_or_zero, + referenced, writable, result); + return 1; } - out: release_pte_pages(pte, _pte, compound_pagelist); trace_mm_collapse_huge_page_isolate(page, none_or_zero, -- 2.30.2