Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3114345pxj; Mon, 17 May 2021 18:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlBUVbX6nrdywpxVh27ubpEjY9LnfjheqagNZfN6WmHhhaZCUVwJJMRWA4/q8th4qopBXV X-Received: by 2002:a17:907:7ba1:: with SMTP id ne33mr3104699ejc.318.1621300111098; Mon, 17 May 2021 18:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621300111; cv=none; d=google.com; s=arc-20160816; b=QSGIpEtSseaNfAYaIqrxk/eTHcdAMOtJxuvPxQP5hThFvABoQzLqH11gsFIZsymST3 y08FkQbjQVUmOQRR+CHsZbe9vbP0JF0a/AVCLq85JVFCd59Wm1n0xozgl3nSiDPgffQF IPRI+j7AX0BpZeFunxF2WSs1zvKY7u+OLQ3lfOsw32FZsscaf+1R0eHMCMGIMlJpRh0/ NL1QLIuTzzb0oDzPhqfdZG+ofavynnWO36lbed9QgFRKXrcUM2ZO4MjsWbHddghdl7Zj BDoo71rXjayIbOhc+Z6qlhcL1snM0TJG+UCXn/2F0gHvZ4J14EhPS7hismKJw/WuX6pN RnXg== 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=hIMweMfGQpbjuUaTDNT9+hwJE7+q8DM+SS8M2WRtTfw=; b=Yvyu2/7uNAFQwT2LwaVAaklLQeFmnAFeuIMWGy5qns2irqybMTX7ocZPt1KuoL3fp4 bDltBZzjfmFFjewRJ9w9N8RIh/Ap8JTe3+ldovt3PQjpeue1JwSCO4BWRi1wb3dDEi/b U1kbSIyo/Ar+s65p5QLZYOO/c+KZG6yFEWmkDlVR3lHVyuoL0x1gMRneOzV0ULJBt4yP JvF3hdTaCcxSSzLtej/F8zbtkPGG4qNxYEVfqDrsCSheLrFi5ESQo9vu0AZliKZdL8JC IRwaYg9UZKEyxsVWw7YjsvLMc0eMMCid3vUmdxwQ2aJVzld12/3zOUzbXD25FdsyY9UR nHaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsPrc5Cp; 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 do16si15570484ejc.105.2021.05.17.18.08.08; Mon, 17 May 2021 18:08:31 -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=PsPrc5Cp; 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 S239570AbhEQOaT (ORCPT + 99 others); Mon, 17 May 2021 10:30:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238982AbhEQO0J (ORCPT ); Mon, 17 May 2021 10:26:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 32C8C614A5; Mon, 17 May 2021 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260795; bh=Tc4Xfujgo7lKLK+r/RlA1VxkaJyRaMx00JEyKZWBu6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsPrc5Cp0yNtudnYrdLzpj2PrfFhToEV+rySPIHZE0aOGQSNTSUxxB69fJJmRY+XF ke5yM2HJN/dxnoQW02MJijMb5sQGNqgFG87XleDhGyrkyr4zA/xx/ju+wV17XBDPyD EYPojXmksrm4IUX04P/NrxhzqfKYeEg49exl35os= 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.12 217/363] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate() Date: Mon, 17 May 2021 16:01:23 +0200 Message-Id: <20210517140309.920063019@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@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 a7d6cb912b05..2680d5ffee7f 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -716,17 +716,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