From patchwork Wed Mar 8 08:33:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13165367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7695C678D5 for ; Wed, 8 Mar 2023 08:12:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B91CD6B0072; Wed, 8 Mar 2023 03:12:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E9506B007B; Wed, 8 Mar 2023 03:12:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 812D5280002; Wed, 8 Mar 2023 03:12:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4F11F6B0072 for ; Wed, 8 Mar 2023 03:12:56 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F1AC4160323 for ; Wed, 8 Mar 2023 08:12:55 +0000 (UTC) X-FDA: 80545015110.15.4A0FC32 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf29.hostedemail.com (Postfix) with ESMTP id 93D3812000D for ; Wed, 8 Mar 2023 08:12:53 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678263174; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nACr05IkdnlTlwIhOKVQZNYjS9RH1sfG5PN/oA2Vl8M=; b=cEmCq2ntEc20JH0FHKUA9wBmsmX7Y8SRAXL9NNOqJPsEOQfbe/DCSBqLipqmOAl5QX6gqe lfsZ+c8Ppf0OHffI9zMV6bdtSpf9oGqJt44BsCtOWOfTMGzm5/XjWNno6VyRvKhlF8VNwO lhjuhtGMV2yYfBjCm/j25jp6jZj8dSs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678263174; a=rsa-sha256; cv=none; b=D6EcChlIWXQ8kEE1hYjD2/yrTYGtoNLkHG9+swraFJxUSXNhZrdIN6PscDTN3w8FmT5w2g ktonyKvL+B5gxknT6AkNL3Y1T4GGRQB1ZM3Gs3Nkr8Y8ob/aUyDWORQ8Err2bUcoo8xukH hGG+5r9vbuFEkJbCD8Z+mFSUkMR8vL4= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PWlPG1fzPzKqMs; Wed, 8 Mar 2023 16:10:42 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 8 Mar 2023 16:12:29 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v3 3/3] mm/damon/paddr: fix missing folio_sz update in damon_pa_young() Date: Wed, 8 Mar 2023 16:33:11 +0800 Message-ID: <20230308083311.120951-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230308083311.120951-1-wangkefeng.wang@huawei.com> References: <20230308083311.120951-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 93D3812000D X-Stat-Signature: xj3rurg87otn51iqowana36hyec1tokq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1678263173-337808 X-HE-Meta: U2FsdGVkX18CIIPGjRfSIC1YYoIm3qrwkbf1MbA2LtnwY2SrqoPKmPehZjLbmxPESvXU3o5rCNTj1/IVC8Jy4O7lxP4pUxCYm5n3lv81tNvwa1EnlcR38KjyhdlDJzfyMoYWWzEkliEAO15blAIVLdT2mkl3ih37NCNYpIsuiFdURLq/1cvRzTWEf5KjBvoEKMbaJzcFjwSKEG+ndpzhftB8Fa/x4af2zTTd7hroNFIAuvQTIesqLvRtgHcfZ/OrhcMItQucyb25BnxPf7NP9+mkT9edFZsngAkGlOMklWYykqzgkmZN8zyOgwNaQbwzBP+p3upvw9MPY56YkP9yLRIYkdXJ/ngA08wTb/jz5pO9KCQ48yxvu4L20/+C/ndtXfcLuAEwArQ8o3B/PIF/u9P+slHxmNsucQEh2AUDkUyiuKu+QNd7q0zI2jmEQbOLQjelypZ37rYpwLrvXPXosbv4qw4nuP07YcAz+E28osDG9RY7WfpW8OLXhAyYMDGWs+lglsrKjNiDW2PHl7H7sSTBN24riCAUC8W0/JsaE9RJXUCNIwexoOD9AF/uQRyiC3Fo9NjvNNJ8lme3BDIc+eQFZlk5UwSuGWbPf/kjDP9p3eRA+fYKJNRKYgkm45b1/tdD0oKjzL1/koJTf76W3DatM734EVGHXpllBMqRTjIxSbHkoNdEKsbPgbdQtGQshLo/st+A0QTgEUHPP6UlB/1MGCmLh+P0gPjwVPYF1O9ADaRPYBRH1F0nONytIvadvcMF5eg+M0skYFxO5oaZ1FQ1xvoXSCdxhRLf9K7RLNYV8KoOp0Nr+6H3jT7ZH8sDublwoZgkK4bCcWHJ6m37dlV+hXJPIznf9Q81fqM6rVzA/pgbEfHM0oFRZ3QagE/ngSn+78FbNeXckEk84P6llyr8uNVVpc17bxAiqRpgBv2klqH2w2hqgl0LY+VbIhrryGxY3mclrkrI2HB9lo/ otu6frku UPssPXnfBb4WjJjyKusbXL+vhRh3TopTDsvWkJOeEVqQ/0+gouVa37cmYmR+qEbNmxMC/xyPnj6TryZGZA9woa+bf5xuAOxv9zOEUk51+lxgw7DGDxo7Pz91/a0w4ibuKk0GiLzuFFaivCodR+JxuGoqNzaJbPUFgexrQ9jZvfuhJOaXwouGPzmm1Y+Rh2Ksftqss2Ap9SVyooP/xCxNzEEaoZw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000042, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The *folio_sz in damon_pa_young() will be used(as last_folio_sz) by __damon_pa_check_access(), so it's need to be updated, fix missing branch. Signed-off-by: Kefeng Wang --- mm/damon/paddr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index b22f6fbb5816..467b99166b43 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -134,10 +134,8 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) } need_lock = !folio_test_anon(folio) || folio_test_ksm(folio); - if (need_lock && !folio_trylock(folio)) { - folio_put(folio); - return false; - } + if (need_lock && !folio_trylock(folio)) + goto out; rmap_walk(folio, &rwc);