Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2121151lkv; Thu, 20 May 2021 03:55:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrJ8H6wEpxIDEP+Pomo5rfArasv2rew3BOfr5iwxzx8kleMff7sQ1CpzkCT/+aUtqnH97S X-Received: by 2002:a05:6402:22a8:: with SMTP id cx8mr4372912edb.296.1621508115886; Thu, 20 May 2021 03:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508115; cv=none; d=google.com; s=arc-20160816; b=bS+kJWYdUY25bxkIe5yKswdSLKrQdiw6k2Q7A2fPDwFWlrMa7NwaYoNrAp6SoBgogx hH5flfF5Jw26qWGVnw1nvTbv5cp6mmc3wMAQ26t80UOm9pqYa1p1KlKAOvntjMbivzvY pTuDxaq3ZBhKHcKVfKdLrm7g/4QGHcSHY4RtbnJh9c94sZ4wrRTxARaryEdbwrMkvDWm td97U214UMIDnhgRFNWaDNH/mFr8Nbkdq2l0GvMbU2umTnPvrTNQANtIh33prBPnmGOk o+/3iRNGOWTPEVYCN2MapJXyGSOsUXcCaUoEjQGiCt3Y7zzRiDq5lbJkSIzDTEfK0YQ1 Eq6g== 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=Tz1qQ7GRphH4PNg/hllJDr61Fk3SyRNQw+mnbXx2swg=; b=IawH1J5a4dYUYe1un0PNiDlXSLgSnS8B4dFjeE7HoCS8cqFiH1cmvsW1QUCv5XmL8/ 98OHvwlQ+Or7D8QYVngXVz41DxGWkYNXNsQMyHp0qISUBBiJ2iYUIYw4SzpuQMyprGeQ Y1l0rpOi0KGJdCVMuJ66phB3gR3rbAPXRzLY1twVOiXYQdJI0e5cVHwtVIhBjCcie9gt rDbp3VTQQhHpWYrouSwhG1eB8LYH0SptfRc0fqgFMBfs8Ew5Z61Vzcddk4oUBSXc5zlr CBqSGvO5Frfpw8UWOj2JaaLyM3J/mn9nT2xXL2RNXc5+Pk4iu6WVI4mDR/2MMq88jOcd ES5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dF469EaE; 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 ci19si2287467ejb.380.2021.05.20.03.54.42; Thu, 20 May 2021 03:55:15 -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=dF469EaE; 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 S236947AbhETKx7 (ORCPT + 99 others); Thu, 20 May 2021 06:53:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237633AbhETKil (ORCPT ); Thu, 20 May 2021 06:38:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8636561C74; Thu, 20 May 2021 09:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504495; bh=oLqyPXjbn46F/aH0DDTO79sqvHyzA1kLxaWkql05L0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dF469EaEF7TPMXco3pKxPepKcKyAUEdG9YD454FqitgesY++z2M6uw+AJ2V0nAWsg uPFZcDPtzN9fqWCWRHN7hm90rzDVtCJyDW/erqpAe99vihuP306QxzLHpwQI+pDR/v xvnVBqfCK2GiGQK342PMCYghyZDkxRa/5Rg0UqcU= 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.14 270/323] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate() Date: Thu, 20 May 2021 11:22:42 +0200 Message-Id: <20210520092129.480155306@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 349b4782d9f4..f426d42d629d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -597,17 +597,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