From patchwork Fri May 24 09:12:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672917 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 A650A85628; Fri, 24 May 2024 09:16:34 +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=1716542196; cv=none; b=l2GA5ubUEOoN1pvcShhra8HPP4uxAcXDBYLVhlO7XeNmQYCmBi3Ehpz/AfBiLhXNlLUtCO+RTG9WlPIJ9VE0fiRBsj9xPvRw8kEU/NUvCXTvBjOErEWh2bcNdwANpAkcraqjUKFyb9VbzX4lGDzQ5FktNdlSBStkDVrkMM1aWEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; c=relaxed/simple; bh=7iiGlxRymc4gE2QRmP2u15Fa02JS2c+W/SOo+UAPaHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j8NaCjp4GWUV0H1Yn+p3SqikyLrVQ+Ohxh0N53XCevNJVhG0KacAcjDOijV0BPK3F08TDPxm90/tIuuqvi3HU9elx7jvabKjVveDNkILbPWXmY7gjRnXZQ0/x9jm7HfJwpF8dWK9CVPcYexBmVBH75V/IojXDWO6Ywb/1QsfTUU= 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.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VlzpM0QJHzsRmy; Fri, 24 May 2024 17:12:43 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 9C485180A9C; Fri, 24 May 2024 17:16:26 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:26 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 01/13] mm/memory-failure: simplify put_ref_page() Date: Fri, 24 May 2024 17:12:58 +0800 Message-ID: <20240524091310.1430048-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Remove unneeded page != NULL check. pfn_to_page() won't return NULL. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index ac030061eda0..922c902a7229 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2150,14 +2150,10 @@ static inline unsigned long folio_free_raw_hwp(struct folio *folio, bool flag) /* Drop the extra refcount in case we come from madvise() */ static void put_ref_page(unsigned long pfn, int flags) { - struct page *page; - if (!(flags & MF_COUNT_INCREASED)) return; - page = pfn_to_page(pfn); - if (page) - put_page(page); + put_page(pfn_to_page(pfn)); } static int memory_failure_dev_pagemap(unsigned long pfn, int flags, From patchwork Fri May 24 09:12:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672914 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 C9B9329422; Fri, 24 May 2024 09:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542193; cv=none; b=sDTS2ufG2yBj1Nd7DTfQZ40jVTW7hnury0ctj+AeZHK7JNpIVNvsCZrCIKvRyYddCEY03iYC+mJlMqMlBd03x37zIaxjgF/6grRd9x3bgZBAZ08RxFBseBuuw8beOXepe5RUqnzebUEdAkBp9KSrIIcWFVkOluWYrwy7tZ5evZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542193; c=relaxed/simple; bh=rwEZ739gHGTO1YqKPyBHYk4+sVARrxvb5W+BR02A2i4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gJzJi7T6AT5CVNWIbAE7W0QJkBbz6NNCckRmWefu9ivDfxiCndPMaJP/UhmXWo7rZg/BEOvoif9kwFBRIoR9F5YOyCAyxdl8wMkF1hKE+QepL3j5nKP4UNHUGYcBZqd1wI1+PKw3BYM0uMJv0t9ac33JdOPz2d2C1qOxO8nBKU4= 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.188 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.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Vlzs84TXDzcj6g; Fri, 24 May 2024 17:15:08 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 2275F180A9C; Fri, 24 May 2024 17:16:27 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:26 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 02/13] mm/memory-failure: remove MF_MSG_SLAB Date: Fri, 24 May 2024 17:12:59 +0800 Message-ID: <20240524091310.1430048-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Since commit 46df8e73a4a3 ("mm: free up PG_slab"), MF_MSG_SLAB becomes unused. Remove it. No functional change intended. Signed-off-by: Miaohe Lin --- include/linux/mm.h | 1 - include/ras/ras_event.h | 1 - mm/memory-failure.c | 1 - 3 files changed, 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3aa1b6889bcc..4bc97ae25ade 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4099,7 +4099,6 @@ enum mf_result { enum mf_action_page_type { MF_MSG_KERNEL, MF_MSG_KERNEL_HIGH_ORDER, - MF_MSG_SLAB, MF_MSG_DIFFERENT_COMPOUND, MF_MSG_HUGE, MF_MSG_FREE_HUGE, diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index b3f6832a94fe..3fe77ba2cdd5 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -356,7 +356,6 @@ TRACE_EVENT(aer_event, #define MF_PAGE_TYPE \ EM ( MF_MSG_KERNEL, "reserved kernel page" ) \ EM ( MF_MSG_KERNEL_HIGH_ORDER, "high-order kernel page" ) \ - EM ( MF_MSG_SLAB, "kernel slab page" ) \ EM ( MF_MSG_DIFFERENT_COMPOUND, "different compound page after locking" ) \ EM ( MF_MSG_HUGE, "huge page" ) \ EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 922c902a7229..9c23adceee75 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -911,7 +911,6 @@ static const char *action_name[] = { static const char * const action_page_types[] = { [MF_MSG_KERNEL] = "reserved kernel page", [MF_MSG_KERNEL_HIGH_ORDER] = "high-order kernel page", - [MF_MSG_SLAB] = "kernel slab page", [MF_MSG_DIFFERENT_COMPOUND] = "different compound page after locking", [MF_MSG_HUGE] = "huge page", [MF_MSG_FREE_HUGE] = "free huge page", From patchwork Fri May 24 09:13:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672919 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 A5DD385627; Fri, 24 May 2024 09:16:34 +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=1716542196; cv=none; b=Qh/PuP6MWZh+w8e3/R+DhB7DLAIEPTPQwGeAZry57hVQCRIeflswQA6tMdTQn5XeOBUcwHZP95o/mtb3g+yBjLW8lJ2e4htCzqPluL1uV//WUklHI+y6JylcLf+ayshFt246V3xF8Qzd4oWZTYkOprblNQjQBBWktJ4g2KBo14w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; c=relaxed/simple; bh=BJQ5Y1QVIHcM4l7Cvr2CsSiO6VipPHGeGZ8/aYXJXLI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pON9eNMvzPzTNblYGpYnhFfgw2NJeH+wRqRGc8ogqr/0ouh1bT3JjCZ385qIIdNMKJEPPM7gw7H/VbunkXqAFqEuXr9trtGdgeTGqWd9oD1+VvTpDcTS1woblimM6bEOxysmGO+TIOdU/yVAYDHThE/2JQm5tMn/LDG3vU/Tvrk= 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.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VlzpQ5VQJzwPF9; Fri, 24 May 2024 17:12:46 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 8A84A18007E; Fri, 24 May 2024 17:16:27 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:27 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 03/13] mm/memory-failure: add macro GET_PAGE_MAX_RETRY_NUM Date: Fri, 24 May 2024 17:13:00 +0800 Message-ID: <20240524091310.1430048-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Add helper macro GET_PAGE_MAX_RETRY_NUM to replace magic number 3. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 9c23adceee75..b571aaf987a2 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1446,6 +1446,8 @@ static int __get_hwpoison_page(struct page *page, unsigned long flags) return 0; } +#define GET_PAGE_MAX_RETRY_NUM 3 + static int get_any_page(struct page *p, unsigned long flags) { int ret = 0, pass = 0; @@ -1460,12 +1462,12 @@ static int get_any_page(struct page *p, unsigned long flags) if (!ret) { if (page_count(p)) { /* We raced with an allocation, retry. */ - if (pass++ < 3) + if (pass++ < GET_PAGE_MAX_RETRY_NUM) goto try_again; ret = -EBUSY; } else if (!PageHuge(p) && !is_free_buddy_page(p)) { /* We raced with put_page, retry. */ - if (pass++ < 3) + if (pass++ < GET_PAGE_MAX_RETRY_NUM) goto try_again; ret = -EIO; } @@ -1491,7 +1493,7 @@ static int get_any_page(struct page *p, unsigned long flags) * A page we cannot handle. Check whether we can turn * it into something we can handle. */ - if (pass++ < 3) { + if (pass++ < GET_PAGE_MAX_RETRY_NUM) { put_page(p); shake_page(p); count_increased = false; From patchwork Fri May 24 09:13:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672921 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 938968563E; Fri, 24 May 2024 09:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542197; cv=none; b=FC+9XRICH+UERYztXB6QzlSBnKiK2tftfrYQa8xaa+Z0hNhNW3WEQ3pIG7QoXd/Welb8ZZdyc8lQcqKX2+HdTjyeNtVZTAVTpxJk0w/EBEjzlgNcL8YPLWFjlpBlhEnd3UMY35JotNPU33IpulFBwsuLFyaytfDYKdRD8ihmw4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542197; c=relaxed/simple; bh=y0w53WfEjSiN1DNwbXvFSfhj2ofhj3Nj68ZTP8Cen5Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z266fp8lUmOWl+dc8R/HsEfSc9RMW0p0gV64Q0o7bq6VUXWMtxyu+UrzuvYyRDXh3JEmdqk8Lmi6mP3lW9HVgCpfEwPtV82Aq7GAcLvsjh9+jud/AP1pbVc7kWRHMDgRFyUvqvrtWIWtWclsqzsnMqo2ZZl+ld7tD+ACKzSpNj4= 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.32 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.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4VlzsF1LTGz1wr5G; Fri, 24 May 2024 17:15:13 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 0C1881402E0; Fri, 24 May 2024 17:16:28 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:27 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 04/13] mm/memory-failure: save a page_folio() call Date: Fri, 24 May 2024 17:13:01 +0800 Message-ID: <20240524091310.1430048-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Use local variable folio directly to save a page_folio() call. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index b571aaf987a2..73878ecdec22 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1658,7 +1658,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p, unmap_success = !page_mapped(p); if (!unmap_success) pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n", - pfn, folio_mapcount(page_folio(p))); + pfn, folio_mapcount(folio)); /* * try_to_unmap() might put mlocked page in lru cache, so call From patchwork Fri May 24 09:13:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672923 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 016F085937; Fri, 24 May 2024 09:16:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542199; cv=none; b=IgUN3TP2tIamphJw5gUTO5uyWLWiZYbA8VmgLxqf1BCfotFqYyheqdfLwZNFt6cOPbIrNz2FuEmEwj4dUFGPA0QWgUqid7EktQQxyhM06BV/xnrNofe0gZYL3XQJ/1xEvD1Cd+dm2nYt9jzvkMeS/AIJyloeVRC/OE9KFbCj2ZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542199; c=relaxed/simple; bh=4ORM+LTuiEk3sa/gaLB3Wh9ziHCUed4N+GPGWhqSDrc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o+6zdSe0mxHwRMR9n76uqiBtN7JW90PkavFjSDwB80Q0wS7xCcSUrWaE/EhFabZBZX20Ahn92XFZg1carA3Fd36NfEwOAuNWvitbE7CRfagWcC+S4jibwtvQ7efl7Rqc9E+RTX4CfJ1z3I9RDsFns0eHUyUORWHRfQ/hFoWapKI= 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.189 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.252]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Vlzq82b8VzPkVR; Fri, 24 May 2024 17:13:24 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 8C739180A9C; Fri, 24 May 2024 17:16:28 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:28 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 05/13] mm/memory-failure: remove unneeded empty string Date: Fri, 24 May 2024 17:13:02 +0800 Message-ID: <20240524091310.1430048-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Remove unneeded empty string in definition of macro pr_fmt. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 73878ecdec22..c09e1bf83682 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2549,7 +2549,7 @@ static int __init memory_failure_init(void) core_initcall(memory_failure_init); #undef pr_fmt -#define pr_fmt(fmt) "" fmt +#define pr_fmt(fmt) fmt #define unpoison_pr_info(fmt, pfn, rs) \ ({ \ if (__ratelimit(rs)) \ From patchwork Fri May 24 09:13:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672915 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 4779982885; Fri, 24 May 2024 09:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542193; cv=none; b=IBmfX1KEJwThz/EXSDrPV2cMRt2E3d6q0+3iRSqq+zwtrtSoI7JIm6E1fdn/TNhAOyVOQn0yFw8vby/CPYR+MrGnbo2+JCs1lfntUgPVKozlddb/9U6oQvyorYp6jWvPFqWT8fd2LHKfS4BOIr/HDx357cUaEujKvZ5x2Hyo2qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542193; c=relaxed/simple; bh=a+7i6UVr7s1OvZFPMfTnRq3Y4SPsKMN0sA81gMMzokA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fi8zw9QWGN4qndN17kR8yf+JySUe/Nbx8m+V4U78kUzC9JjeXIUr2s/u6LIZKYGXk2Hw6G+sus8VmgZxpS4hO6Q/p5feVQwGDbBPJjApF74JLxaBElL1hQAzcIfCJnUrVfEwjs1SjJFK17jGU+WDpn8imQQuQ1PrzlXratHIimE= 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.188 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.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VlzsB3xbCzchZC; Fri, 24 May 2024 17:15:10 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 0DD9F140132; Fri, 24 May 2024 17:16:29 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:28 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 06/13] mm/memory-failure: remove confusing initialization to count Date: Fri, 24 May 2024 17:13:03 +0800 Message-ID: <20240524091310.1430048-7-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) It's meaningless and confusing to init local variable count to 1. Remove it. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c09e1bf83682..be9bda281d91 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2573,7 +2573,7 @@ int unpoison_memory(unsigned long pfn) struct folio *folio; struct page *p; int ret = -EBUSY, ghp; - unsigned long count = 1; + unsigned long count; bool huge = false; static DEFINE_RATELIMIT_STATE(unpoison_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); From patchwork Fri May 24 09:13:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672922 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 8E4EC8565D; Fri, 24 May 2024 09:16:36 +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=1716542198; cv=none; b=NBbd+IItrwa20XLzCNID6LCHSId/dbYUWj38gLUfpIHb2Sx5f1KyUO/JEykX7zheSlKNJZCSQXW47DICmfoFrucbyAGw1jpRhQrY7pFYUuMLh+MFs4GDGEYZc5ioreHJ/HuQ32AqeolIqjc94+bbJYiYfezI1zqVfJJktJIp47Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542198; c=relaxed/simple; bh=ZqDUGoNqwZr9tSCJGpH3UTAdxs4ktSCRIfIdbyZA4oE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZLmHP2Yf0pecOuKITN0FMDOEeDIDZxXgx9xK/1L574lJyAraH3JZQxk5Nz86hojKM5swSztkMzdcZN0WVqEf9IHF/dYXrGQKpXFwrBX2cztQ4upw3CCTggCaVY4haIC5mHOWzK7XKejnS/sYNxOaoce7pk7iXpPK+1GeI/joiMQ= 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 4VlzpS5W1SzwPHB; Fri, 24 May 2024 17:12:48 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 8B0631400D1; Fri, 24 May 2024 17:16:29 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:29 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 07/13] mm/memory-failure: remove unneeded hwpoison_filter() variant Date: Fri, 24 May 2024 17:13:04 +0800 Message-ID: <20240524091310.1430048-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) When CONFIG_HWPOISON_INJECT is not enabled, there is no user of the hwpoison_filter(). Remove it. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index be9bda281d91..2c3ecbfc2134 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -294,14 +294,8 @@ int hwpoison_filter(struct page *p) return 0; } -#else -int hwpoison_filter(struct page *p) -{ - return 0; -} -#endif - EXPORT_SYMBOL_GPL(hwpoison_filter); +#endif /* * Kill all processes that have a poisoned page mapped and then isolate From patchwork Fri May 24 09:13:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672925 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 8A2FE85C69; Fri, 24 May 2024 09:16:37 +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=1716542199; cv=none; b=JEfM6DGbu5Dtk2/4DRl59hkCXpK1MLdYiZIFGZosVFqoymD8OTFPIjDhOrwwz8m5R+pjXgbycD2ktLEYs+ETdVWrju+zVo8c4C2cHJJj+0x4MPkQgT4mS8G6RWtlzg2lD5Jucs6ePnKT+wsHaUD7wqRmHTci63BCnHoORgpSa9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542199; c=relaxed/simple; bh=2l/HnKNW7m8L+dYV3Z20Y12gb/3RrpQ7muKsdZwTe/4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PHniNEpJNFQpVfrFtEm/Dr7ZV5Ua48A4pZ/zPgxmYvn0W4unnJSzAMTWGskIaGPOFRmCko74Db5L2/dHm+zCaQzm0pANMit3hITtKRwHmZ+sZ/CYlb8LuKQ+XIoega6UPk+2DvUUYo4QpQquyk37qYGYkOTvbzcFptUYzmi3KZU= 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.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VlzpQ3LHqzsR5g; Fri, 24 May 2024 17:12:46 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 0AB32180A9C; Fri, 24 May 2024 17:16:30 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:29 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 08/13] mm/memory-failure: use helper macro task_pid_nr() Date: Fri, 24 May 2024 17:13:05 +0800 Message-ID: <20240524091310.1430048-9-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Use helper macro task_pid_nr() to get the pid of a task. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 2c3ecbfc2134..19d338e83e43 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -338,7 +338,7 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) int ret = 0; pr_err("%#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n", - pfn, t->comm, t->pid); + pfn, t->comm, task_pid_nr(t)); if ((flags & MF_ACTION_REQUIRED) && (t == current)) ret = force_sig_mceerr(BUS_MCEERR_AR, @@ -356,7 +356,7 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) addr_lsb, t); if (ret < 0) pr_info("Error sending signal to %s:%d: %d\n", - t->comm, t->pid, ret); + t->comm, task_pid_nr(t), ret); return ret; } @@ -518,7 +518,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, if (forcekill) { if (tk->addr == -EFAULT) { pr_err("%#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n", - pfn, tk->tsk->comm, tk->tsk->pid); + pfn, tk->tsk->comm, task_pid_nr(tk->tsk)); do_send_sig_info(SIGKILL, SEND_SIG_PRIV, tk->tsk, PIDTYPE_PID); } @@ -531,7 +531,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, */ else if (kill_proc(tk, pfn, flags) < 0) pr_err("%#lx: Cannot send advisory machine check signal to %s:%d\n", - pfn, tk->tsk->comm, tk->tsk->pid); + pfn, tk->tsk->comm, task_pid_nr(tk->tsk)); } list_del(&tk->nd); put_task_struct(tk->tsk); From patchwork Fri May 24 09:13:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672924 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 9946A85C76; Fri, 24 May 2024 09:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542199; cv=none; b=Zt+vDv23EJd/b1uus8Bywvezd60xSB8OzwohJ1hM6Z8UKApOUJQk4a2VitRplVk0B663WdLJLhtev3mswI1xsMmhgXXn7bOzuRz7VIpQTob2o6AwXIi8Mz79nQyKGrKuDvELW6Ur0wo9f1QOoqG5jbHd65JZr3qRsHmGpH/+qf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542199; c=relaxed/simple; bh=RqqyeXN49L+OxvoPKSY+bYr6mtFoqKTj/RQxWasN8sQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GKztQZ6UFXaGuCMXHpS7xSv/cwcJgMEzjsHG+ksj55unY+vtOtl05aQM41JuXqm0/8J8VT/kIxjScIy3gUz+CeCPfSsQcqZ5UjD2iENWY8Snrs5Lvx86vVs4XgR5WyhWSitlfBAlUe4++Vq5RHANLAa9HnV35XgSi7BZ2pMjDqw= 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.255 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 szxga08-in.huawei.com (SkyGuard) with ESMTP id 4VlzpT6NSWz1S4rl; Fri, 24 May 2024 17:12:49 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 803351400D1; Fri, 24 May 2024 17:16:30 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:29 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 09/13] mm/memory-failure: remove obsolete comment in unpoison_memory() Date: Fri, 24 May 2024 17:13:06 +0800 Message-ID: <20240524091310.1430048-10-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Since commit 130d4df57390 ("mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head"), folio->_mapcount is not overloaded with SLAB. Update corresponding comment. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand --- mm/memory-failure.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 19d338e83e43..e4252f297d41 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2610,10 +2610,6 @@ int unpoison_memory(unsigned long pfn) folio_test_reserved(folio) || folio_test_offline(folio)) goto unlock_mutex; - /* - * Note that folio->_mapcount is overloaded in SLAB, so the simple test - * in folio_mapped() has to be done after folio_test_slab() is checked. - */ if (folio_mapped(folio)) { unpoison_pr_info("Unpoison: Someone maps the hwpoison page %#lx\n", pfn, &unpoison_rs); From patchwork Fri May 24 09:13:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672927 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (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 BA6CF8627E; Fri, 24 May 2024 09:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542200; cv=none; b=aaX7bBfiJZ8yQ174IoLAq0nAEYdpf2cVZ4obUOMQDc4N3d7fC2eQEsaCBCF31YtjbJKJQXd1fAsm32ishmt+V0P5uEDd4Ezuczee27SnnxAU8ZA+Di1HY5qvbmkd/+UkljdeO48cFt01KwqLF811HRPygENha7ZHjDwUb/BLZfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542200; c=relaxed/simple; bh=U4M+mqIJ6eqNJrMY3nhiyUmONLQVAM6acKtLt0LVyIc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H+WJIZQ+PcQJbiWfSNnJ3yMScYN77PrBwAKqN4WjaMv7mL0FL/knDl7g4T4bwJr5y/OkFC9Nh2w8Rkvi8H2aAkIXkcrsK+lpZnfK7ycowrHO9Rzp/ZnQy33jzd7BvgzhNfpcInql7OpRnYj6QeZJ1wl4X9akPPahfBqsTMZmE98= 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.35 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.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Vlzph0Cgyz1S5bv; Fri, 24 May 2024 17:13:00 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 10C4F14037C; Fri, 24 May 2024 17:16:31 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:30 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 10/13] mm/memory-failure: move some function declarations into internal.h Date: Fri, 24 May 2024 17:13:07 +0800 Message-ID: <20240524091310.1430048-11-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) There are some functions only used inside mm. Move them into internal.h. No functional change intended. Signed-off-by: Miaohe Lin --- include/linux/mm.h | 13 ------------- include/linux/page-flags.h | 5 ----- include/linux/rmap.h | 2 -- mm/internal.h | 16 ++++++++++++++++ 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 4bc97ae25ade..d5174b3b792b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1330,12 +1330,6 @@ static inline unsigned long page_size(struct page *page) return PAGE_SIZE << compound_order(page); } -/* Returns the number of bits needed for the number of bytes in a page */ -static inline unsigned int page_shift(struct page *page) -{ - return PAGE_SHIFT + compound_order(page); -} - /** * thp_order - Order of a transparent huge page. * @page: Head page of a transparent huge page. @@ -4032,7 +4026,6 @@ extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); void num_poisoned_pages_inc(unsigned long pfn); void num_poisoned_pages_sub(unsigned long pfn, long i); -struct task_struct *task_early_kill(struct task_struct *tsk, int force_early); #else static inline void memory_failure_queue(unsigned long pfn, int flags) { @@ -4053,12 +4046,6 @@ static inline void num_poisoned_pages_sub(unsigned long pfn, long i) } #endif -#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_KSM) -void add_to_kill_ksm(struct task_struct *tsk, struct page *p, - struct vm_area_struct *vma, struct list_head *to_kill, - unsigned long ksm_addr); -#endif - #if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG) extern void memblk_nr_poison_inc(unsigned long pfn); extern void memblk_nr_poison_sub(unsigned long pfn, long i); diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 104078afe0b1..00c33a6ea367 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -616,11 +616,6 @@ PAGEFLAG_FALSE(Uncached, uncached) PAGEFLAG(HWPoison, hwpoison, PF_ANY) TESTSCFLAG(HWPoison, hwpoison, PF_ANY) #define __PG_HWPOISON (1UL << PG_hwpoison) -#define MAGIC_HWPOISON 0x48575053U /* HWPS */ -extern void SetPageHWPoisonTakenOff(struct page *page); -extern void ClearPageHWPoisonTakenOff(struct page *page); -extern bool take_page_off_buddy(struct page *page); -extern bool put_page_back_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison, hwpoison) #define __PG_HWPOISON 0 diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 5cb0d419a1d7..ece0515ee21c 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -733,8 +733,6 @@ int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff, void remove_migration_ptes(struct folio *src, struct folio *dst, bool locked); -unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); - /* * rmap_walk_control: To control rmap traversing for specific needs * diff --git a/mm/internal.h b/mm/internal.h index bbec99cc9d9d..188e292d2a77 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1061,6 +1061,22 @@ extern u64 hwpoison_filter_flags_mask; extern u64 hwpoison_filter_flags_value; extern u64 hwpoison_filter_memcg; extern u32 hwpoison_filter_enable; +#define MAGIC_HWPOISON 0x48575053U /* HWPS */ +extern void SetPageHWPoisonTakenOff(struct page *page); +extern void ClearPageHWPoisonTakenOff(struct page *page); +extern bool take_page_off_buddy(struct page *page); +extern bool put_page_back_buddy(struct page *page); +struct task_struct *task_early_kill(struct task_struct *tsk, int force_early); +void add_to_kill_ksm(struct task_struct *tsk, struct page *p, + struct vm_area_struct *vma, struct list_head *to_kill, + unsigned long ksm_addr); +unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); + +/* Returns the number of bits needed for the number of bytes in a page */ +static inline unsigned int page_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long, unsigned long, unsigned long, From patchwork Fri May 24 09:13:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672926 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 9F7A78626E; Fri, 24 May 2024 09:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542200; cv=none; b=YYs1QO7GM2pzyMEYzi62i9zftHzw9pr30WS3RkYGxRjpYOXdgXb+OxhHsR6bOrQVgKl5iR5wGk0EFIIbfMtBIQ5cUL5raYb3SJxwb7CO4/XU1HrBSZdkPZavC9Yb9T4/Hhl+ZUtyu413dAeVbyVNa+53cYzpHOX+rGh07/7aKEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542200; c=relaxed/simple; bh=er7HX24yFsOrH0ScrFR/OGLdgsJH/93guW1I8ORBqe8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EAT0FpsaXp8yWqNow3JOmY9UFHnTh//SjFE+O9inQVkY1d/UrDceErEK2xaXAPCHjiF5sb8k2a0eDGIZ0XgzMTZVEIMV5V83T2J2pmFH89FU4bFFMzVeKvru/h55AgqmRcZo2hKDCfL5Wg3wlG5PgTFXdyzwoJRRH1wVT6mZJIs= 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.189 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 szxga03-in.huawei.com (SkyGuard) with ESMTP id 4VlzqC226JzPmWX; Fri, 24 May 2024 17:13:27 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 7A7CC1400D1; Fri, 24 May 2024 17:16:31 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:30 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 11/13] mm/memory-failure: fix comment of get_hwpoison_page() Date: Fri, 24 May 2024 17:13:08 +0800 Message-ID: <20240524091310.1430048-12-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) When return value is 0, it could also means the page is free hugetlb page or free buddy page. Fix the corresponding comment. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index e4252f297d41..705cd0bbb603 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1549,7 +1549,7 @@ static int __get_unpoison_page(struct page *page) * the given page has PG_hwpoison. So it's never reused for other page * allocations, and __get_unpoison_page() never races with them. * - * Return: 0 on failure, + * Return: 0 on failure or free buddy (hugetlb) page, * 1 on success for in-use pages in a well-defined state, * -EIO for pages on which we can not handle memory errors, * -EBUSY when get_hwpoison_page() has raced with page lifecycle From patchwork Fri May 24 09:13:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672918 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 918218529E; Fri, 24 May 2024 09:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; cv=none; b=lzjrsClcbwpZN6pUTnii3+fU0hXApvJrZWzz171axmxZzvdcZP3kEdwdJNAIoLjNhohD3Byr8C7oK7yZJgl8v36B1sQDhaXUZItc7mFKJ9eVyMSBX6W4VfTkplbC5ih4eUNgahqSD2ZO94ZJ20hU8dwG7N4Ya++Jrp9Trjo3gk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; c=relaxed/simple; bh=dl3BaYvhEF+oy+IXg3fZfQU4v7868fSoS23t7LjBaiM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PomQA/qprliyUAo6PGowfW8KxNaSZsDw4Qm2Nj4M8R5Jqhi7miAkSShNrgUfISmTgK2JoIS6z7Ir/gn0C6nzcl3Seie3N5nkEd+RsRgalrtQlAhKz6gihXB8MtDnyOoGZhOLoi0VA8ssZIH1D1HRszTeKK7DqHP3AVuALFO94jY= 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.191 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.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Vlzpj3Z9Dz2cMp7; Fri, 24 May 2024 17:13:01 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 0423A14037C; Fri, 24 May 2024 17:16:32 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:31 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 12/13] mm/memory-failure: remove obsolete comment in kill_proc() Date: Fri, 24 May 2024 17:13:09 +0800 Message-ID: <20240524091310.1430048-13-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) When user sets SIGBUS to SIG_IGN, it won't cause loop now. For action required mce error, SIGBUS cannot be blocked. Also when a hwpoisoned page is re-accessed, kill_accessing_process() will be called to kill the process. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 705cd0bbb603..b6bdb4e2834a 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -349,8 +349,6 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) * PF_MCE_EARLY set. * Don't use force here, it's convenient if the signal * can be temporarily blocked. - * This could cause a loop when the user sets SIGBUS - * to SIG_IGN, but hopefully no one will do that? */ ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr, addr_lsb, t); From patchwork Fri May 24 09:13:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672920 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 D165A85634; Fri, 24 May 2024 09:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; cv=none; b=VFFKWIW7RGmR/X7yA39gzHZxmyJ/YdKzL4oIII2YC5Bx+jSQW4nT4M4UOLNN7mhaE7xfmUWmFAOmy2qJLFZ57Q8zf1NitaI7qKhkYGJrWz68/2q8xf0EdTdyItb6Sum8maU6Tn6a6MH8143bq11/R9rfUYuJqYIKFqv0U9AZt5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542196; c=relaxed/simple; bh=QM21hj2Jz5wBPhDuCLolpQBGMoHySqd7jjYhrdKlfoo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q2bfhdTj+1dIX3QL9V8MPwuG50xrBBJDvgRQYfiLpq5Sbh5IwLZ+Q9SsmufZjWUFDIP3DCZUvxOdE9tW1lKWrP75Q83oh3NkgLEEgqYIm3JhhmW0ARTDR+XGpcGm+Xxkiv4MxL7/aA3JisnZ740E/CMLQTmmIrhdGLdUQwalplU= 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.191 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.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Vlzpk0WFPz2cMp9; Fri, 24 May 2024 17:13:02 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 8F42714037C; Fri, 24 May 2024 17:16:32 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:31 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 13/13] mm/memory-failure: correct comment in me_swapcache_dirty Date: Fri, 24 May 2024 17:13:10 +0800 Message-ID: <20240524091310.1430048-14-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Dirty swap cache page could live both in page table (not page cache) and swap cache when freshly swapped in. Correct comment. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index b6bdb4e2834a..16bf67ffa56a 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1150,7 +1150,7 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p) * Clean and dirty swap cache. * * Dirty swap cache page is tricky to handle. The page could live both in page - * cache and swap cache(ie. page is freshly swapped in). So it could be + * table and swap cache(ie. page is freshly swapped in). So it could be * referenced concurrently by 2 types of PTEs: * normal PTEs and swap PTEs. We try to handle them consistently by calling * try_to_unmap(!TTU_HWPOISON) to convert the normal PTEs to swap PTEs,