Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp372890pxj; Thu, 20 May 2021 11:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrAKQpeCZLAuoj4JzC9Y/QmdnEEZ3Ozx3l8g1nHf2RzxzJ+ZcEBma+jiOQd6pgqynlQ1T+ X-Received: by 2002:a5d:8c82:: with SMTP id g2mr6415947ion.34.1621534583191; Thu, 20 May 2021 11:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621534583; cv=none; d=google.com; s=arc-20160816; b=lBUNtuuJrMopc4LxzEvkzK7Whn51yKyQcLITzPlUYg5+BW5JSiti1prUhE0v0QXGwn x5mnCP2uhjC2yGUlDk0+zLE8t60Taj5j+6rtcuBwM9EMFkbbiRVUF0JhNm70/kO9mkc0 zKEdFdJgaDP2WEEnYneVe+AyrE6bky8iq4jfBnS6/nYtb3zk5zL6HG7McOmqa3QRIOp+ RaErxRy1lkWCNSIXcW1kJ6ej+TUbgrQ9tkJ0vXm3v2nVBJQb5LgznoEVd2fIa3GImJRw 2qRnx80CWleNkgQYOp9WPK0PqgfrMthdjlaoewldLz3KjAs4pxmuoBPR6gpJwzAdOHI1 AGFQ== 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=fGNfjh+h9ioNkKEVzoUW8FTilWUeVuWtsYeoP5CDjp4=; b=mzrDS7qFoliMt41Buxcy5+U85jCg8jYv+iMm/zTpAmgUjzGBuJksclm2Vf6Zz2wqBc hDmy+Sm8v2e7GaB3xCSPlAXbDtiL3eFPJc26Gu9BBwWfXOR5QOozSFiw8d7+GcHoj2aK DMR0a763UaWf961WDXW/+zHqIn9BFYnY96Zs4YZuG2AXX0BLxUcqmOD23nBLGFwVZVQF 8n/dOx1aQRPVB0+sMQTb8Cp+QhpBz+VOCt90+tV2Lo3WefRQKNp7qM315YUsUUSe8rOF nxBgTlLaRaw9bKS5YUsQwg3bydm1e/jd3TwrRUHavwYYaYpk1IE0UlfLwDfirg2es+4l c2pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iwNcMxXM; 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 x9si3623854ilu.78.2021.05.20.11.16.08; Thu, 20 May 2021 11:16:23 -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=iwNcMxXM; 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 S236358AbhETKPD (ORCPT + 99 others); Thu, 20 May 2021 06:15:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:38312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235745AbhETKIN (ORCPT ); Thu, 20 May 2021 06:08:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CA84F6143C; Thu, 20 May 2021 09:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503727; bh=vQ8fKtqdSyHLjNaVlTmVC7t+4hCQi+OGFrEfsQ342qI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iwNcMxXMVrrNxn8Hed4QjSas0CAH+FdsM8gXKAMK05VBBBM//eb04B5/uIVDrUdRe vCiGIs+6q/XHONHlnlKZPkjM4HkxyY/ywhh2hdg9I4AKqkD8RopyIspvoMCRNPoMYo 8f3PN9FIhphFnpa1MsvQ1DaBvDaUHcNLwJVD8JtU= 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 4.19 352/425] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate() Date: Thu, 20 May 2021 11:22:01 +0200 Message-Id: <20210520092142.973634718@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 9c7dc2276156..5dd14ef2e1de 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -616,17 +616,17 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, mmu_notifier_test_young(vma->vm_mm, address)) referenced++; } - 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); trace_mm_collapse_huge_page_isolate(page, none_or_zero, -- 2.30.2