From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC912DDBE for ; Tue, 21 Jan 2025 02:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737427623; cv=none; b=gPTGm+WK+UInFxokmEVUkz+F3sUOup8ko83+7lagHMvC67wkvZghJ2D0GIhiqScnTQN3GudmuRX7eG8ce8yFi/zAZlk8CytlZrbIX+ZP+lkXg7EXiRafNaXJxGqLfBgAsPZm3Epls9WnkUEaNnC7OevNeLHbJ4wql2qVS1SgOvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737427623; c=relaxed/simple; bh=qOVCBuzZGSgFCxNDmw0XrUMDc8WsXBuv8ev5+VAN2Kw=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=J2tFQnmR2e2kyPBODbZxM2PHfU+EXdOrPPN7CWVF4PdGOyEQopRm9I/DXivTPT0wS9epoxmtpGTXP/Phl5JLdvzPV/AVxi9kNFqZwfzBmxak9JySpGZpqnN/NalHpiHDq9AaxMGItSx0/2MxqJ6RUPQyQO0oER+VPdMo08z1HmY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YcWj10PSXzjYDQ; Tue, 21 Jan 2025 10:43:01 +0800 (CST) Received: from kwepemd200019.china.huawei.com (unknown [7.221.188.193]) by mail.maildlp.com (Postfix) with ESMTPS id 7BD971400CD; Tue, 21 Jan 2025 10:46:59 +0800 (CST) Received: from [10.173.127.72] (10.173.127.72) by kwepemd200019.china.huawei.com (7.221.188.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 21 Jan 2025 10:46:58 +0800 Subject: Re: [PATCH v2 1/3] mm: memory-failure: update ttu flag inside unmap_poisoned_folio To: David Hildenbrand CC: , , , , , , Wupeng Ma References: <20250116061657.227027-1-mawupeng1@huawei.com> <20250116061657.227027-2-mawupeng1@huawei.com> <21674fcc-bd5d-3e32-6e45-f0a16ab93202@huawei.com> <34ccd133-7623-4cd8-aad7-08526a97c472@redhat.com> From: Miaohe Lin Message-ID: <74b97e70-fa21-28c3-cb51-3a4ffb1b581a@huawei.com> Date: Tue, 21 Jan 2025 10:46:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <34ccd133-7623-4cd8-aad7-08526a97c472@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd200019.china.huawei.com (7.221.188.193) On 2025/1/20 15:49, David Hildenbrand wrote: > >>>       if (folio_test_hugetlb(folio) && !folio_test_anon(folio)) { >>>           struct address_space *mapping; >>>   @@ -1572,7 +1598,7 @@ void unmap_poisoned_folio(struct folio *folio, enum ttu_flags ttu) >>>           if (!mapping) { >>>               pr_info("%#lx: could not lock mapping for mapped hugetlb folio\n", >>>                   folio_pfn(folio)); >>> -            return; >>> +            return -EBUSY; >>>           } >>>             try_to_unmap(folio, ttu|TTU_RMAP_LOCKED); >>> @@ -1580,6 +1606,8 @@ void unmap_poisoned_folio(struct folio *folio, enum ttu_flags ttu) >>>       } else { >>>           try_to_unmap(folio, ttu); >>>       } >>> + >>> +    return folio_mapped(folio) ? -EBUSY : 0; >> >> Do we really need this return value? It's unused in do_migrate_range(). > > I suggested it, because the folio_mapped() is nowadays extremely cheap. It cleans up hwpoison_user_mappings() quite nicely. > > Any particular reason we shouldn't be doing that? I was trying to keep code more clean (IMO) but no strong opinion. Thanks. .