From patchwork Fri Jun 28 20:59:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13716602 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 84D94C30658 for ; Fri, 28 Jun 2024 21:00:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E1B86B008C; Fri, 28 Jun 2024 17:00:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 669666B0092; Fri, 28 Jun 2024 17:00:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E3266B0095; Fri, 28 Jun 2024 17:00:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2A2876B008C for ; Fri, 28 Jun 2024 17:00:06 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D5F2FA076D for ; Fri, 28 Jun 2024 21:00:05 +0000 (UTC) X-FDA: 82281514770.07.192EA3D Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf13.hostedemail.com (Postfix) with ESMTP id 102F020004 for ; Fri, 28 Jun 2024 21:00:03 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=AxpUwWaG; spf=pass (imf13.hostedemail.com: domain of 3UiR_ZggKCNE65xD5LxA3BB381.zB985AHK-997Ixz7.BE3@flex--jiaqiyan.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3UiR_ZggKCNE65xD5LxA3BB381.zB985AHK-997Ixz7.BE3@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719608389; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=r0CbibTHvg/Mc5IP1SBIsRIj2TjPoTYgF7QMmo8HErQ=; b=RlyDg/4tP+0TVQTQrC3ihkU9IDAIRk/YMgMk5FMcEBH5H9OboWNIBhqSFM54FalRGuwRJS mQ2FM4NDgG0hm6cP/+KtjCbVL4V5/ABJAug7iFEQoGnPCHcDWfqP7Fu5VXtUPDvXx2IizD nzX0ROL1IsEXgNPNRlVoCblja+K/+Q8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=AxpUwWaG; spf=pass (imf13.hostedemail.com: domain of 3UiR_ZggKCNE65xD5LxA3BB381.zB985AHK-997Ixz7.BE3@flex--jiaqiyan.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3UiR_ZggKCNE65xD5LxA3BB381.zB985AHK-997Ixz7.BE3@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719608389; a=rsa-sha256; cv=none; b=8hne9ONPxuXVbOYaaRokLBqO2qH8bss9nwUBIxSD+Es0989TUzYqrBPkxNEyHIWp5NC+bm qgfTNvC0thsmPGgReDjMUySCPQWDExMBJGx9W+r0JFmqkWfwuuSwj20oeHqfqb0ULrtM/k QuaNsGXziYNeGE1E/+TQidJV4rPTrcQ= Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-1faa4e6e43eso7236745ad.1 for ; Fri, 28 Jun 2024 14:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719608403; x=1720213203; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=r0CbibTHvg/Mc5IP1SBIsRIj2TjPoTYgF7QMmo8HErQ=; b=AxpUwWaGmPOrzzQ9r2hWOZSGL20DhflGYL9qUT2SLYCU8x/MwZLKO0CIJtr9S6cVTu H/5v0DaesLPoL88mK8auMfhTLqRY0EcY0zI7h09wzDAFaFNJKXz/JJpPl8SnukisM+jx RGqnn8VJjuXzeztISH1GqG3jaq3AF69Swb0TWe407W5voDwfCBvY8YLRUCEUh+vl7zww 2wZ5rX78Ubxh7mO8xPp97+EgrZbx3XCaE0T43Qu05nK9XvTiUcOleVxNQMc4BEluVkLF HLzwTj4plKBpqB61hnp1CH9H145JHYEKhxFhnLpU9mcpsrhIWV9G/zo2XZxB6bSI+muY bWPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719608403; x=1720213203; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r0CbibTHvg/Mc5IP1SBIsRIj2TjPoTYgF7QMmo8HErQ=; b=YFOaTGVRghK3yOW6AmfA1DaSRLLMwcvS5bA8zLr3KHMejYrfN866xavbjpciecj71C +O9CGHPLdPJmFoLcOAX2Vgh2u2JHJCINTCaLFEaovR1y16pbsqnHh4hz8g7d22uHcM2f 5RE+WB6cnhHSh8Xm5FfD5bBARJ5ogtp8j+0AX+WoheFMC5tLjdoxDO+q3pa95clVYCXe BIIUg9c4yNWUIBgJkeXfFrzm2xa9v7QLuIZ3MOLEBMVxM6B2MghUtR2d1s/qGpOSnUvK o9ZCdB11AN20LuumCiUCzbbt6s6+7CJyaCzAYg4Z+8ItBpZkkzUXfnz9B+q3kIsY8N0F eR1w== X-Forwarded-Encrypted: i=1; AJvYcCXIJLnbQcLEdjGjqoca62z1ao+yQZXFpb+YC97hmTRuFB326ReohDtYbjS3hax51aj47UdmKcBYZ5fLM9QLnH+ZSQU= X-Gm-Message-State: AOJu0YzJUVj6qVVAJEBaKoAk9ObpimemS5Whf4B+OqccZgPlG64OP3qo sV9yLOmoWFJQ2StvubS1AiWANepNQL20N0gU6xk2ZSDwOsb6B4E+JHr3AduDARM8FwbvPBuwuzn mxV4MVcWCCA== X-Google-Smtp-Source: AGHT+IHvSyTDpXGxBgupVIRFAkBG3VdCY5GUBbjJLmgeOIsfaxOiwkfDkgH572hLnULmbZAu+zNkcopy7a37Yw== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a17:902:facf:b0:1f7:1640:cef0 with SMTP id d9443c01a7336-1fa1d668ce5mr424595ad.12.1719608402621; Fri, 28 Jun 2024 14:00:02 -0700 (PDT) Date: Fri, 28 Jun 2024 20:59:55 +0000 In-Reply-To: <20240628205958.2845610-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20240628205958.2845610-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240628205958.2845610-2-jiaqiyan@google.com> Subject: [PATCH v7 1/4] mm/memory-failure: refactor log format in soft offline code From: Jiaqi Yan To: nao.horiguchi@gmail.com, linmiaohe@huawei.com Cc: jane.chu@oracle.com, ioworker0@gmail.com, muchun.song@linux.dev, akpm@linux-foundation.org, shuah@kernel.org, rdunlap@infradead.org, corbet@lwn.net, osalvador@suse.de, rientjes@google.com, duenwen@google.com, fvdl@google.com, ak@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Jiaqi Yan X-Stat-Signature: jqxqg1nemofopctx9d49xxa4j5pejrt6 X-Rspam-User: X-Rspamd-Queue-Id: 102F020004 X-Rspamd-Server: rspam02 X-HE-Tag: 1719608403-808163 X-HE-Meta: U2FsdGVkX19S8c/1ki0O6m02bSX03fTGtp0FSk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Y9Iy2XiaIwJ7G9PgpqA3CN+NAK5DOt74kqrH2cSQgVowGp4PltV92648xztDOnCQVxxv/zV616BkmbYnMgXv+jjB/KaByBfX11EiZkTRmpzpcVA+N3sLjjTBgvUvV/dF1G3xtkJoCk19iy4MHT5xcRD3QOGDN+LdAJaF52tkeVOZ03Q0ddyyjsYVUfRb7xA2Nf2pX35cFVRGVtZCgxcsXsRPLPAPYEXQhLURraaLTZxWCy4j6p/KJj80Cef6KvA1ByqTAJk/YV1TnwOYhmALtFY27lvZPXREoAnao7xexqFUQ8hqLM9bGKKLOhb4v/f7IxvQCfdkcq99B1m9feTktcfoNwzAFt/gd05J6ZACnFEng31rzKnc+VJl09Fd1NtKhy0RIIIyZED48ypg7K5hoqO/w6OWB9vRcKu++M/0hj6s2e5lzVvUGPhhAlK0mrbx2u8F2b2fKD3q5aqo+EsIs2yY9i7WA9r2y3AArm6nyqJMzldM6AtIP9NjTMyCAsiLcA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Logs from soft_offline_page and soft_offline_in_use_page have different formats than majority of the memory failure code: "Memory failure: 0x${pfn}: ${lower_case_message}" Convert them to the following format: "Soft offline: 0x${pfn}: ${lower_case_message}" No functional change in this commit. Acked-by: Miaohe Lin Signed-off-by: Jiaqi Yan Reviewed-by: Lance Yang --- mm/memory-failure.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 2cf7acc286de..685ab9a77966 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2640,6 +2640,9 @@ int unpoison_memory(unsigned long pfn) } EXPORT_SYMBOL(unpoison_memory); +#undef pr_fmt +#define pr_fmt(fmt) "Soft offline: " fmt + static bool mf_isolate_folio(struct folio *folio, struct list_head *pagelist) { bool isolated = false; @@ -2695,7 +2698,7 @@ static int soft_offline_in_use_page(struct page *page) if (!huge && folio_test_large(folio)) { if (try_to_split_thp_page(page, true)) { - pr_info("soft offline: %#lx: thp split failed\n", pfn); + pr_info("%#lx: thp split failed\n", pfn); return -EBUSY; } folio = page_folio(page); @@ -2707,7 +2710,7 @@ static int soft_offline_in_use_page(struct page *page) if (PageHWPoison(page)) { folio_unlock(folio); folio_put(folio); - pr_info("soft offline: %#lx page already poisoned\n", pfn); + pr_info("%#lx: page already poisoned\n", pfn); return 0; } @@ -2720,7 +2723,7 @@ static int soft_offline_in_use_page(struct page *page) folio_unlock(folio); if (ret) { - pr_info("soft_offline: %#lx: invalidated\n", pfn); + pr_info("%#lx: invalidated\n", pfn); page_handle_poison(page, false, true); return 0; } @@ -2737,13 +2740,13 @@ static int soft_offline_in_use_page(struct page *page) if (!list_empty(&pagelist)) putback_movable_pages(&pagelist); - pr_info("soft offline: %#lx: %s migration failed %ld, type %pGp\n", + pr_info("%#lx: %s migration failed %ld, type %pGp\n", pfn, msg_page[huge], ret, &page->flags); if (ret > 0) ret = -EBUSY; } } else { - pr_info("soft offline: %#lx: %s isolation failed, page count %d, type %pGp\n", + pr_info("%#lx: %s isolation failed, page count %d, type %pGp\n", pfn, msg_page[huge], page_count(page), &page->flags); ret = -EBUSY; } @@ -2795,7 +2798,7 @@ int soft_offline_page(unsigned long pfn, int flags) mutex_lock(&mf_mutex); if (PageHWPoison(page)) { - pr_info("%s: %#lx page already poisoned\n", __func__, pfn); + pr_info("%#lx: page already poisoned\n", pfn); put_ref_page(pfn, flags); mutex_unlock(&mf_mutex); return 0; From patchwork Fri Jun 28 20:59:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13716603 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 E4495C2BD09 for ; Fri, 28 Jun 2024 21:00:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C383C6B0092; Fri, 28 Jun 2024 17:00:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC02C6B0095; Fri, 28 Jun 2024 17:00:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ED2B6B0096; Fri, 28 Jun 2024 17:00:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 76BDC6B0092 for ; Fri, 28 Jun 2024 17:00:07 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 311F7A05E9 for ; Fri, 28 Jun 2024 21:00:07 +0000 (UTC) X-FDA: 82281514854.29.BC5D483 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf08.hostedemail.com (Postfix) with ESMTP id 6246F160022 for ; Fri, 28 Jun 2024 21:00:05 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DyMEXEBP; spf=pass (imf08.hostedemail.com: domain of 3VCR_ZggKCNM87zF7NzC5DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--jiaqiyan.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3VCR_ZggKCNM87zF7NzC5DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719608395; a=rsa-sha256; cv=none; b=MFdJaZZfDCmVBSKfGIjAdItJBzGMXmAmzyCxfnxDKppQEQxOuJ2NTsaKuAJYTXXqa9h7F/ koxed9OUn5/rz6OiaTzqhzVcXsaETP0BcmvyblyFdUTUO7QLbhaMlhaNMJkv9JzGQ3eRIq Aw6QNs83s4f35s36/VMFhZqpzLRf6qA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DyMEXEBP; spf=pass (imf08.hostedemail.com: domain of 3VCR_ZggKCNM87zF7NzC5DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--jiaqiyan.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3VCR_ZggKCNM87zF7NzC5DD5A3.1DBA7CJM-BB9Kz19.DG5@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719608395; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wloQRnRJOFsUL3bZC7DzXWvVx2ebdRLN4PLJ4fxz/Zs=; b=2riFIZbgcoxNI52ZPoWS+tBpHe6l9fw+K+VhiZAs61y+7tIk73WNoYXFWeDEF4McX929VQ hUkZ7lGneQ+UPHYciEpIx4lT62mHntvq51eNvZrR6enmqXjotNBvNP86JxoKHMltJYfIin 8el04QI6xFAn9iHQfxDKHEXdXQ+4ipM= Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-1f99666500aso8568355ad.0 for ; Fri, 28 Jun 2024 14:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719608404; x=1720213204; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=wloQRnRJOFsUL3bZC7DzXWvVx2ebdRLN4PLJ4fxz/Zs=; b=DyMEXEBPU6jT6PJiXD5EYmh701uTZOz9rXdnBCYTHozLYoowfau5h24jDGJnyDGuoc hOFlrkYZjzN9VJpJkFsGnNWzs+Ku2cZTtQDuEyXYeExfVH9/VKcL3tvqlwENjZGXnqmt tlvV12s4jxnDISjTpvsMDaTLgySG63xJ7cO/YvCawMFVnbe17yaL0amBIDdnaHZlaaEb KV5EBpNj7veKCOctOBRnrdRKPvT6Mz8YPr43EhIsl+U/A7v8xV0QeKvpQ9QbmZiuQ/fC x4ticP3yZ55HN8DQzhaJyAHgSKyfCu59w7doxLuNWepP9IkJ+YLcESHzvAoo/m1jGM+R ui1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719608404; x=1720213204; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wloQRnRJOFsUL3bZC7DzXWvVx2ebdRLN4PLJ4fxz/Zs=; b=fj3MAMBldfwvANeXC/GRkDxWHfaB23icyOBwzTJ+x4Ix9XFvpObDDmzFs5ieE8ux+t vfcoRu5PogiDtt+J3ZlIEzS7mFRTEkRWRRxp+mbhrZTziG0PyF4B6Q0LuFiBsf+dOsBz nuKZyEk0gNqNsjUpCI1CtuWPGWG0hPW94YVr+HuarXyazij0TT4aq6yOJLIb2lx4wdiX JOPGalt4cnqkhFueyUpgczyCkezI74H98JOUiE6hi6pEOU8/vDTo3tjnfkpMufu2SISM Y6ib+4OmG2KCRLcNHas8Wl7Zv10UgMG/IkYhj/GLi1SHD57PvDEGBk1zmtlWm5dV6GKk 797w== X-Forwarded-Encrypted: i=1; AJvYcCWkJ57hXsaHnckPLCVyeSYu6V61108H7cOyxjywJi63Svvpuiyal/cZshwiZWy6vzd+44jGCCNVzR19lJOG1zaw6SY= X-Gm-Message-State: AOJu0Yyk6h902rraNMgERabC2K17OHIxEUQLJq9IVhKA1jvmP6Um+Lx6 V1g94fNwZnT479scZ0mizaKYxJgRMJ2T83bWn6ullmgp7zQd+XuDb3rPxIeD0NIzTGw7af/ff8u Gm2GfoM0hTA== X-Google-Smtp-Source: AGHT+IFngVlviz+bFsu7ULS0zV0gCgvaUcH7TCcU6sghaFwvanKOQPhlg4lFgTCSFwGFZC7AMJvWD60uCEYyCw== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a17:902:e5c8:b0:1fa:9149:4979 with SMTP id d9443c01a7336-1fa91494ca4mr7717605ad.2.1719608404213; Fri, 28 Jun 2024 14:00:04 -0700 (PDT) Date: Fri, 28 Jun 2024 20:59:56 +0000 In-Reply-To: <20240628205958.2845610-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20240628205958.2845610-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240628205958.2845610-3-jiaqiyan@google.com> Subject: [PATCH v7 2/4] mm/memory-failure: userspace controls soft-offlining pages From: Jiaqi Yan To: nao.horiguchi@gmail.com, linmiaohe@huawei.com Cc: jane.chu@oracle.com, ioworker0@gmail.com, muchun.song@linux.dev, akpm@linux-foundation.org, shuah@kernel.org, rdunlap@infradead.org, corbet@lwn.net, osalvador@suse.de, rientjes@google.com, duenwen@google.com, fvdl@google.com, ak@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Jiaqi Yan X-Stat-Signature: 8ghfqny964nuqf4xhhxn145bks48h47a X-Rspamd-Queue-Id: 6246F160022 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719608405-465423 X-HE-Meta: U2FsdGVkX19cOEWvn6VoSYjywv374u0nvVRoJ1dtwOq35349hZwDT019I/YmC3O5uVNktU6BdBJuhzM5a1NFBUQSv0QZudMSnOFwGWiT2pz79R3u135UF4IKMTvKUH17Rw6LLT6d1jq7voiUpImEiTBWCoTwEcDUyKfn2IZAMk4JaaijglM33OVdExFZHOfZCWDLVC3vz9NpMaL0m/0yZuEJaWjXThxE0BljOaagQW8kcTuC0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r4msbaf5IQWi5Qi3x0eiAA4sntmzYDDqnEPBk9Veld7B59KGXZrTcdtMRJdpA74Bul541PIDeutPWGTCOPMh1AB/Z83gLNBxuSdCHUu6WIvfUlhN9gPcU3XpEgYuvGYRl3+pknmd8UCWRYYUsKLZqZuNFygWGrsobE01O7NHAvJf1HcIp423W8ZjDD+SEFovOi00i12RztqDf7LK3Yk2dizCaS9b/E4Q+hFci/GwNHOzL/aRYZqboFgADklEJ4pB5z5LNUXyUWz7nmUyJodu2O/xBRDodMFtKX677y/7txRYQ5f1jHkmpEm X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Correctable memory errors are very common on servers with large amount of memory, and are corrected by ECC. Soft offline is kernel's additional recovery handling for memory pages having (excessive) corrected memory errors. Impacted page is migrated to a healthy page if inuse; the original page is discarded for any future use. The actual policy on whether (and when) to soft offline should be maintained by userspace, especially in case of an 1G HugeTLB page. Soft-offline dissolves the HugeTLB page, either in-use or free, into chunks of 4K pages, reducing HugeTLB pool capacity by 1 hugepage. If userspace has not acknowledged such behavior, it may be surprised when later failed to mmap hugepages due to lack of hugepages. In case of a transparent hugepage, it will be split into 4K pages as well; userspace will stop enjoying the transparent performance. In addition, discarding the entire 1G HugeTLB page only because of corrected memory errors sounds very costly and kernel better not doing under the hood. But today there are at least 2 such cases doing so: 1. when GHES driver sees both GHES_SEV_CORRECTED and CPER_SEC_ERROR_THRESHOLD_EXCEEDED after parsing CPER. 2. RAS Correctable Errors Collector counts correctable errors per PFN and when the counter for a PFN reaches threshold In both cases, userspace has no control of the soft offline performed by kernel's memory failure recovery. This commit gives userspace the control of softofflining any page: kernel only soft offlines raw page / transparent hugepage / HugeTLB hugepage if userspace has agreed to. The interface to userspace is a new sysctl at /proc/sys/vm/enable_soft_offline. By default its value is set to 1 to preserve existing behavior in kernel. When set to 0, soft-offline (e.g. MADV_SOFT_OFFLINE) will fail with EOPNOTSUPP. Acked-by: Miaohe Lin Acked-by: David Rientjes Signed-off-by: Jiaqi Yan --- mm/memory-failure.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 685ab9a77966..d55fdeed0cfc 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -68,6 +68,8 @@ static int sysctl_memory_failure_early_kill __read_mostly; static int sysctl_memory_failure_recovery __read_mostly = 1; +static int sysctl_enable_soft_offline __read_mostly = 1; + atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); static bool hw_memory_failure __read_mostly = false; @@ -141,6 +143,15 @@ static struct ctl_table memory_failure_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, + { + .procname = "enable_soft_offline", + .data = &sysctl_enable_soft_offline, + .maxlen = sizeof(sysctl_enable_soft_offline), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + } }; /* @@ -2758,8 +2769,9 @@ static int soft_offline_in_use_page(struct page *page) * @pfn: pfn to soft-offline * @flags: flags. Same as memory_failure(). * - * Returns 0 on success - * -EOPNOTSUPP for hwpoison_filter() filtered the error event + * Returns 0 on success, + * -EOPNOTSUPP for hwpoison_filter() filtered the error event, or + * disabled by /proc/sys/vm/enable_soft_offline, * < 0 otherwise negated errno. * * Soft offline a page, by migration or invalidation, @@ -2795,6 +2807,12 @@ int soft_offline_page(unsigned long pfn, int flags) return -EIO; } + if (!sysctl_enable_soft_offline) { + pr_info_once("disabled by /proc/sys/vm/enable_soft_offline\n"); + put_ref_page(pfn, flags); + return -EOPNOTSUPP; + } + mutex_lock(&mf_mutex); if (PageHWPoison(page)) { From patchwork Fri Jun 28 20:59:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13716604 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 1F116C30658 for ; Fri, 28 Jun 2024 21:00:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FCA16B0096; Fri, 28 Jun 2024 17:00:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E74F6B0098; Fri, 28 Jun 2024 17:00:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 163036B0099; Fri, 28 Jun 2024 17:00:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D8F6F6B0096 for ; Fri, 28 Jun 2024 17:00:09 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 58E1140779 for ; Fri, 28 Jun 2024 21:00:09 +0000 (UTC) X-FDA: 82281514938.02.10A7C62 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf10.hostedemail.com (Postfix) with ESMTP id 7C1CFC000E for ; Fri, 28 Jun 2024 21:00:07 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0FHkO8Fl; spf=pass (imf10.hostedemail.com: domain of 3VSR_ZggKCNQ980G8O0D6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--jiaqiyan.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3VSR_ZggKCNQ980G8O0D6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719608389; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LX2k2Odth3Czy1UPzCvu++jrFt8goB6d9yMZ+ndJ/Y8=; b=kJd26MtPjKjU9ueUU14SQW9jhyzrfutdN0YydR4OymUsii7ctxW73bZuXO5oou2BKcnHXK ajoXuVyAurtaMOdtAGODS532/Fz4QMTWCPgunHG9N8l7484KUVisOXx+YjudDPaCUQET8R v0MS4l5HLZVLvu3LecNN36HcIF6D4Tk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719608389; a=rsa-sha256; cv=none; b=mxCjgUFxjbF30MBWcSn1YOY9646iUL+HkdispWQijvCejiyxZZ/bjKcPU8dA6cbfJwLeWh DtMIh415yJhh9V9UbPSc6Vdhs1mB4UzSrk5/PqzK582duzxF6YrfUKTsMJxpTxb3EzXJcy aDUZ8ggGlrCzEFNavKOlywwXzlL1vcw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0FHkO8Fl; spf=pass (imf10.hostedemail.com: domain of 3VSR_ZggKCNQ980G8O0D6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--jiaqiyan.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3VSR_ZggKCNQ980G8O0D6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-718c62ad099so767541a12.3 for ; Fri, 28 Jun 2024 14:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719608406; x=1720213206; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LX2k2Odth3Czy1UPzCvu++jrFt8goB6d9yMZ+ndJ/Y8=; b=0FHkO8FlxFjxNzFyrZVnjLvPuZwtATvgrR1sDY321udKJDzSMY1J+B20aEJREO52/F kfPQzSMxdb32HZBONsNurjQUn7u56jCXjYFpRQy2DjMJsbEcHKO78WVhPKFDJom/8QbK jZ4D5nYMwBHuwKW0EFUoyX8KdRmlaktD3Dw5MHLpD3HccVzCBIOaM+9HdPPk6g6TwZxv zZMa8RlJPQaC+XNZJ6uyPqSozl6r9BAsxrRgp9TOdE8cFxTk3LAjM1iwhreXzLVnL9jA JoW2XglVxCLa1FcNm1KkRpFHU8m/QU0KzcmtDsx0uMv2b0lDdeohICeUJsTuitk8lrI2 hXug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719608406; x=1720213206; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LX2k2Odth3Czy1UPzCvu++jrFt8goB6d9yMZ+ndJ/Y8=; b=LctkYRYPD9qoN7hfzq6cCDZ2/8icNx9QtRiZgFUinPHph+uvf/ewsstQ83FpI3pQYR udBAgVWyqop+iBHIpFhCtjQu+PD1xB0sgNR5BLtoZEhrMgbjXhLeifa3qjsW97RaCtIs JRefnp1dsIIz6PkqOcTxRiIUJvoFDL3SPQDooR/ObMt16BPI07jugV0t7Q3qOvXcciXN sYm79ha6gaeXgaZFIKoYfXjCP0VY4axiRVAzpBPoo7HryntwN9rmuVQTvX3H2JxCngod 7B1i14ITFSsCUCdOFmxkK2gF5xF/roqbjcReFIzweg/nYdP2dUMFXJWqiBZ7Ac5tFy3E f3vw== X-Forwarded-Encrypted: i=1; AJvYcCWY/rcjfosT8iopEbpWQNFqiG5MkuoA981Ief/V4c18cDzSiheLZGjAs81L3g75xqacyEHDkjgTLfA88Lg79R3Q/gs= X-Gm-Message-State: AOJu0YwEbFnSnOKYQDGyl7ZDeJ1cJKjyK1Xd4GNq8piYN5uktF84/tWO TIdpXs/BZ/tehKJm4KQRQwsfHmFBtXLrU4BOTuuCvsK52daNem/SzSrUlikOVuWeqFenV1VEMfn PEET0G3f7FQ== X-Google-Smtp-Source: AGHT+IEOnM2DmpIwo9UplyJX5c7ScIunYeQjWO3FSTx8VD2hKPYukIltq7alsOpJeqnRkjeE7/AeNNFxxG+TFA== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a63:7151:0:b0:6e5:9777:4b0a with SMTP id 41be03b00d2f7-71a39d74f05mr42746a12.8.1719608405925; Fri, 28 Jun 2024 14:00:05 -0700 (PDT) Date: Fri, 28 Jun 2024 20:59:57 +0000 In-Reply-To: <20240628205958.2845610-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20240628205958.2845610-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240628205958.2845610-4-jiaqiyan@google.com> Subject: [PATCH v7 3/4] selftest/mm: test enable_soft_offline behaviors From: Jiaqi Yan To: nao.horiguchi@gmail.com, linmiaohe@huawei.com Cc: jane.chu@oracle.com, ioworker0@gmail.com, muchun.song@linux.dev, akpm@linux-foundation.org, shuah@kernel.org, rdunlap@infradead.org, corbet@lwn.net, osalvador@suse.de, rientjes@google.com, duenwen@google.com, fvdl@google.com, ak@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Jiaqi Yan X-Rspamd-Queue-Id: 7C1CFC000E X-Stat-Signature: zdfue5um498ymnw8pxgeewfnsijbu5kf X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719608407-546361 X-HE-Meta: U2FsdGVkX19MhT2c2+t8qeFafC8iLKrUp+vU+sIwfqjIvB2Xl/P2hjWusXyeSev6urwYBE1CwUVPwbbnY6hZUjbObxK7SoM7Lqsz4YhFZDBgLIaMXFI0rIT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U2Pc/QMyg0oNxkVjOWYiwrbe0VAfhnPWeds4s9iwSSYfHCHe1zi3RCfsT9yE8VZOP8Q53/PNLZw0hH7QrBF+SuaD4wwZSwPgPjflITkWPzoe+ffEGyxHKSBNjhCg2voW6uU6HJe+4yEaK8nRPMIjcj0nWP0TBfTChyRSCLGXYtaQXiNIRiXCorRNST1t5L6hZfuYxJvgUKUdUkAlqjOyLFJh6g05GfPj2AO5YmdXb+JV24IOn14JnD0xmm69F65asMS1kj/NXvMP2/5FwzEuYiSdBZzWr5GpAO8V9E5MfmMrYl2qbkPZII4iV1R8vMlhIJHu4VVneJx59KtmV4wRBI82A3lNkwOUz6MAZL2T6FzdWoZVZXvH2+QpZ1/8QIgBfRB+TgmhiB3CwSBVLf/LJoG94C4gAzvux5SclLRu94tr6Dui3Nt/0VjY4VbFF+qv2T2aV4YkcQSP8sm51z98w= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add regression and new tests when hugepage has correctable memory errors, and how userspace wants to deal with it: * if enable_soft_offline=1, mapped hugepage is soft offlined * if enable_soft_offline=0, mapped hugepage is intact Free hugepages case is not explicitly covered by the tests. Hugepage having corrected memory errors is emulated with MADV_SOFT_OFFLINE. Acked-by: Miaohe Lin Signed-off-by: Jiaqi Yan Acked-by: David Rientjes --- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/hugetlb-soft-offline.c | 228 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 6 + 4 files changed, 236 insertions(+) create mode 100644 tools/testing/selftests/mm/hugetlb-soft-offline.c diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 0b9ab987601c..064e7b125643 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -6,6 +6,7 @@ hugepage-shm hugepage-vmemmap hugetlb-madvise hugetlb-read-hwpoison +hugetlb-soft-offline khugepaged map_hugetlb map_populate diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 0d96c6123636..e1aa09ddaa3d 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -43,6 +43,7 @@ TEST_GEN_FILES += gup_test TEST_GEN_FILES += hmm-tests TEST_GEN_FILES += hugetlb-madvise TEST_GEN_FILES += hugetlb-read-hwpoison +TEST_GEN_FILES += hugetlb-soft-offline TEST_GEN_FILES += hugepage-mmap TEST_GEN_FILES += hugepage-mremap TEST_GEN_FILES += hugepage-shm diff --git a/tools/testing/selftests/mm/hugetlb-soft-offline.c b/tools/testing/selftests/mm/hugetlb-soft-offline.c new file mode 100644 index 000000000000..f086f0e04756 --- /dev/null +++ b/tools/testing/selftests/mm/hugetlb-soft-offline.c @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Test soft offline behavior for HugeTLB pages: + * - if enable_soft_offline = 0, hugepages should stay intact and soft + * offlining failed with EOPNOTSUPP. + * - if enable_soft_offline = 1, a hugepage should be dissolved and + * nr_hugepages/free_hugepages should be reduced by 1. + * + * Before running, make sure more than 2 hugepages of default_hugepagesz + * are allocated. For example, if /proc/meminfo/Hugepagesize is 2048kB: + * echo 8 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "../kselftest.h" + +#ifndef MADV_SOFT_OFFLINE +#define MADV_SOFT_OFFLINE 101 +#endif + +#define EPREFIX " !!! " + +static int do_soft_offline(int fd, size_t len, int expect_errno) +{ + char *filemap = NULL; + char *hwp_addr = NULL; + const unsigned long pagesize = getpagesize(); + int ret = 0; + + if (ftruncate(fd, len) < 0) { + ksft_perror(EPREFIX "ftruncate to len failed"); + return -1; + } + + filemap = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_POPULATE, fd, 0); + if (filemap == MAP_FAILED) { + ksft_perror(EPREFIX "mmap failed"); + ret = -1; + goto untruncate; + } + + memset(filemap, 0xab, len); + ksft_print_msg("Allocated %#lx bytes of hugetlb pages\n", len); + + hwp_addr = filemap + len / 2; + ret = madvise(hwp_addr, pagesize, MADV_SOFT_OFFLINE); + ksft_print_msg("MADV_SOFT_OFFLINE %p ret=%d, errno=%d\n", + hwp_addr, ret, errno); + if (ret != 0) + ksft_perror(EPREFIX "madvise failed"); + + if (errno == expect_errno) + ret = 0; + else { + ksft_print_msg("MADV_SOFT_OFFLINE should ret %d\n", + expect_errno); + ret = -1; + } + + munmap(filemap, len); +untruncate: + if (ftruncate(fd, 0) < 0) + ksft_perror(EPREFIX "ftruncate back to 0 failed"); + + return ret; +} + +static int set_enable_soft_offline(int value) +{ + char cmd[256] = {0}; + FILE *cmdfile = NULL; + + if (value != 0 && value != 1) + return -EINVAL; + + sprintf(cmd, "echo %d > /proc/sys/vm/enable_soft_offline", value); + cmdfile = popen(cmd, "r"); + + if (cmdfile) + ksft_print_msg("enable_soft_offline => %d\n", value); + else { + ksft_perror(EPREFIX "failed to set enable_soft_offline"); + return errno; + } + + pclose(cmdfile); + return 0; +} + +static int read_nr_hugepages(unsigned long hugepage_size, + unsigned long *nr_hugepages) +{ + char buffer[256] = {0}; + char cmd[256] = {0}; + + sprintf(cmd, "cat /sys/kernel/mm/hugepages/hugepages-%ldkB/nr_hugepages", + hugepage_size); + FILE *cmdfile = popen(cmd, "r"); + + if (cmdfile == NULL) { + ksft_perror(EPREFIX "failed to popen nr_hugepages"); + return -1; + } + + if (!fgets(buffer, sizeof(buffer), cmdfile)) { + ksft_perror(EPREFIX "failed to read nr_hugepages"); + pclose(cmdfile); + return -1; + } + + *nr_hugepages = atoll(buffer); + pclose(cmdfile); + return 0; +} + +static int create_hugetlbfs_file(struct statfs *file_stat) +{ + int fd; + + fd = memfd_create("hugetlb_tmp", MFD_HUGETLB); + if (fd < 0) { + ksft_perror(EPREFIX "could not open hugetlbfs file"); + return -1; + } + + memset(file_stat, 0, sizeof(*file_stat)); + if (fstatfs(fd, file_stat)) { + ksft_perror(EPREFIX "fstatfs failed"); + goto close; + } + if (file_stat->f_type != HUGETLBFS_MAGIC) { + ksft_print_msg(EPREFIX "not hugetlbfs file\n"); + goto close; + } + + return fd; +close: + close(fd); + return -1; +} + +static void test_soft_offline_common(int enable_soft_offline) +{ + int fd; + int expect_errno = enable_soft_offline ? 0 : EOPNOTSUPP; + struct statfs file_stat; + unsigned long hugepagesize_kb = 0; + unsigned long nr_hugepages_before = 0; + unsigned long nr_hugepages_after = 0; + int ret; + + ksft_print_msg("Test soft-offline when enabled_soft_offline=%d\n", + enable_soft_offline); + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) + ksft_exit_fail_msg("Failed to create hugetlbfs file\n"); + + hugepagesize_kb = file_stat.f_bsize / 1024; + ksft_print_msg("Hugepagesize is %ldkB\n", hugepagesize_kb); + + if (set_enable_soft_offline(enable_soft_offline) != 0) { + close(fd); + ksft_exit_fail_msg("Failed to set enable_soft_offline\n"); + } + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_before) != 0) { + close(fd); + ksft_exit_fail_msg("Failed to read nr_hugepages\n"); + } + + ksft_print_msg("Before MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_before); + + ret = do_soft_offline(fd, 2 * file_stat.f_bsize, expect_errno); + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_after) != 0) { + close(fd); + ksft_exit_fail_msg("Failed to read nr_hugepages\n"); + } + + ksft_print_msg("After MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_after); + + // No need for the hugetlbfs file from now on. + close(fd); + + if (enable_soft_offline) { + if (nr_hugepages_before != nr_hugepages_after + 1) { + ksft_test_result_fail("MADV_SOFT_OFFLINE should reduced 1 hugepage\n"); + return; + } + } else { + if (nr_hugepages_before != nr_hugepages_after) { + ksft_test_result_fail("MADV_SOFT_OFFLINE reduced %lu hugepages\n", + nr_hugepages_before - nr_hugepages_after); + return; + } + } + + ksft_test_result(ret == 0, + "Test soft-offline when enabled_soft_offline=%d\n", + enable_soft_offline); +} + +int main(int argc, char **argv) +{ + ksft_print_header(); + ksft_set_plan(2); + + test_soft_offline_common(1); + test_soft_offline_common(0); + + ksft_finished(); +} diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 5698d519170d..03ac4f2e1cce 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -332,6 +332,12 @@ CATEGORY="hugetlb" run_test ./thuge-gen CATEGORY="hugetlb" run_test ./charge_reserved_hugetlb.sh -cgroup-v2 CATEGORY="hugetlb" run_test ./hugetlb_reparenting_test.sh -cgroup-v2 if $RUN_DESTRUCTIVE; then +nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages) +enable_soft_offline=$(cat /proc/sys/vm/enable_soft_offline) +echo 8 > /proc/sys/vm/nr_hugepages +CATEGORY="hugetlb" run_test ./hugetlb-soft-offline +echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages +echo "$enable_soft_offline" > /proc/sys/vm/enable_soft_offline CATEGORY="hugetlb" run_test ./hugetlb-read-hwpoison fi From patchwork Fri Jun 28 20:59:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13716605 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 70205C2BD09 for ; Fri, 28 Jun 2024 21:00:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 847DF6B0098; Fri, 28 Jun 2024 17:00:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CCA46B009A; Fri, 28 Jun 2024 17:00:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55A616B009B; Fri, 28 Jun 2024 17:00:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2E9236B0098 for ; Fri, 28 Jun 2024 17:00:11 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D98031206BC for ; Fri, 28 Jun 2024 21:00:10 +0000 (UTC) X-FDA: 82281514980.17.F1C31AF Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf07.hostedemail.com (Postfix) with ESMTP id 1710840010 for ; Fri, 28 Jun 2024 21:00:08 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=kxgToHib; spf=pass (imf07.hostedemail.com: domain of 3VyR_ZggKCNYBA2IAQ2F8GG8D6.4GEDAFMP-EECN24C.GJ8@flex--jiaqiyan.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3VyR_ZggKCNYBA2IAQ2F8GG8D6.4GEDAFMP-EECN24C.GJ8@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719608394; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K55H9E0t59nm9KeHZLiBbB7OkhvKOcAfSENsb6p/u6w=; b=k4f0X30hHAYiapPZWIqGlFpv7IjGS0j2n25ANZYDGqktw6TpvZYVMZZSXQQLwUKi3G+Dgv d4QLXakUG2gDGA25tl0+zEE9DnnQfgTNXBTv3OjJ9TDEfu/0nU6ADDwLR8j0IYkwtUC2MW aDsYmiGStQj5sV/QVe3XAunEYBWbijc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=kxgToHib; spf=pass (imf07.hostedemail.com: domain of 3VyR_ZggKCNYBA2IAQ2F8GG8D6.4GEDAFMP-EECN24C.GJ8@flex--jiaqiyan.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3VyR_ZggKCNYBA2IAQ2F8GG8D6.4GEDAFMP-EECN24C.GJ8@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719608394; a=rsa-sha256; cv=none; b=czIXtarp0eNav6+y8Ge058dmOripUK6KbqMKh0WR/fmzutUsQZnpfZzzfuOUsS1KBwpc3p c5PuZqz68SWJkyGBlg+Jr/kxaA3bZ+Na9iTIqdt8SLN7T0JocorfqIl/I4+4LfvOgaOWOo vB4VTmi70USqUe9GuzvYZeN4lZzJc/Y= Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-7066693876aso902772b3a.3 for ; Fri, 28 Jun 2024 14:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719608408; x=1720213208; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=K55H9E0t59nm9KeHZLiBbB7OkhvKOcAfSENsb6p/u6w=; b=kxgToHibns5aIEv0DDTd+gQdhJ2b116kq1eGLy4xhYUaizXa62LE4qMRYg1rwb9rwZ wPeiggHtTn1llfYB/siuCQu1Nro5II+fid2FBty+RzRqD2AFqbZujTyH3gd5oHYLm0Vr e9Y7Dtj5zNCgQcOr12vR10uhynN5gFCew/0TDF1awYK8xrO0IdLYoipb/xkUe/SwlFZa PBoE4R8F7OfadVDSEFhaIcYw0DtPyZToMifMRQ8jOBgKf4vQiqc6BPDTynWyuptltki/ errvTfsom/NdtDIhMYQKXoOZIEOSqn5xfy/Y+5n87Lm5/ZKcFsRlkGXtUsLxCnKs8IUb wzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719608408; x=1720213208; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K55H9E0t59nm9KeHZLiBbB7OkhvKOcAfSENsb6p/u6w=; b=DaneubHAUi7AT/utG1IpO6EFzyHlIL3RtYT8CTXur3xAa7vtQkqMOEVGmk3fW2T/Gw QuayKum0ujcUSHI1omc9xyf+IwHI4gp8iKx43HFByo4PN5I4bPlwBSNYvRuH+Ez6EYtM xyLVb/IRlVuXnOuCbkegvaioyjc1QjBKdY/pGogUp7mWXZhqeUOjQG9PaZEoaW9Eu1l4 xdioVfgORJJ2r4PrKkJ2A0eCv10MJGIwxlHLADAlzpR8lFOuesqlDWHNj3SRPrmjqX7F f3/K5hWAFaURCcI1Fdpwjiulyby0OfPMPCxCcKhcQJgAmXMUYL3S2ZhHD3bMJ8U8H1Zr ZnhA== X-Forwarded-Encrypted: i=1; AJvYcCUbtkX5S1hBnF2I/2VMHkc/mQWaCiXEkVweAKKJlikmVyL18Iv+PErI2bvBSe5yAg6L9DeZbZUbahwFjg+ONPxyR7c= X-Gm-Message-State: AOJu0YxbDJxnsIV8BPHcHfpV+d7Q04w9rBAKiP3vf/kxVPUBE9wI+fqt fgLPRJzZAMnQCOqPOeR4H61r7P7aDriIPNMnrjGoQMSl60/xAYLDkeP/VNdi4llzaxmZjJewNjl 84sX3k9F8bg== X-Google-Smtp-Source: AGHT+IFbZGpVVtA+GUKb/6c6jsaI0OiKjqock+AA+pWiWe+A5unyUwPSLs/SOm+K4zdLrXzAV8wcIH5VRSCYXg== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a05:6a00:3698:b0:706:6b52:43a7 with SMTP id d2e1a72fcca58-706746db53fmr184314b3a.3.1719608407790; Fri, 28 Jun 2024 14:00:07 -0700 (PDT) Date: Fri, 28 Jun 2024 20:59:58 +0000 In-Reply-To: <20240628205958.2845610-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20240628205958.2845610-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240628205958.2845610-5-jiaqiyan@google.com> Subject: [PATCH v7 4/4] docs: mm: add enable_soft_offline sysctl From: Jiaqi Yan To: nao.horiguchi@gmail.com, linmiaohe@huawei.com Cc: jane.chu@oracle.com, ioworker0@gmail.com, muchun.song@linux.dev, akpm@linux-foundation.org, shuah@kernel.org, rdunlap@infradead.org, corbet@lwn.net, osalvador@suse.de, rientjes@google.com, duenwen@google.com, fvdl@google.com, ak@linux.intel.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Jiaqi Yan X-Stat-Signature: otncubz888tyzzigpkjn1o8ojn4k5n3n X-Rspam-User: X-Rspamd-Queue-Id: 1710840010 X-Rspamd-Server: rspam02 X-HE-Tag: 1719608408-930522 X-HE-Meta: U2FsdGVkX1/XQTcAXZ8BzahRw/DZ4BzXD4Xm6F4LDVDq8DaWEIjS1u9hFwmI+Avcghqg84S4WnLrSvjHK8Cp1TdqklCNG4B1rF1pJ13fXNT/a/uNMev4SMfZglRDY56iUBVgUmzswmqsGfTLYgk8CJvLANQxk56hpsRaSyh4ZmJs25WSgwDKuF2XoGy1VVmeSXz1H+cxVc1YEvnQZWjyPwSKAYVulGvjzJ6HbyUxpsgarLh7xacp2z6uY9h0HxGK3m++ClOltsbhEg3ldwSrNThUlna4sPH8/OUibTKhCXoXKUK5qjfLoPCRrOkDBIRZlpC1AqF935joVGO2jOB/oJPCzoHmd6tjx1U9/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bnWEbeRYNIAb+GLSG0XpAHnMXkC1HhCvy2E/kM71dYS+guZsQurvWQXfhFpNK1p6R9R5lgCF3IuRbAdFotO/ZTmmZSX02yvHTbvCKARo3HKXVKuuMjWXqn2o6Ouu5R6n8STzWqNBFwx6HCQCTRicO+lDtONBdm3nh+FpcGe6sVHqXVQustMmPmK1qf1mJvGrPBmX1yqGlbqV5dm5lnoQEZEJaBoP1kT/FS/qgMq6ask= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add the documentation for soft offline behaviors / costs, and what the new enable_soft_offline sysctl is for. Acked-by: Oscar Salvador Acked-by: Miaohe Lin Signed-off-by: Jiaqi Yan Acked-by: David Rientjes --- Documentation/admin-guide/sysctl/vm.rst | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst index e86c968a7a0e..75e22137d849 100644 --- a/Documentation/admin-guide/sysctl/vm.rst +++ b/Documentation/admin-guide/sysctl/vm.rst @@ -36,6 +36,7 @@ Currently, these files are in /proc/sys/vm: - dirtytime_expire_seconds - dirty_writeback_centisecs - drop_caches +- enable_soft_offline - extfrag_threshold - highmem_is_dirtyable - hugetlb_shm_group @@ -267,6 +268,37 @@ used:: These are informational only. They do not mean that anything is wrong with your system. To disable them, echo 4 (bit 2) into drop_caches. +enable_soft_offline +=================== +Correctable memory errors are very common on servers. Soft-offline is kernel's +solution for memory pages having (excessive) corrected memory errors. + +For different types of page, soft-offline has different behaviors / costs. +- For a raw error page, soft-offline migrates the in-use page's content to + a new raw page. +- For a page that is part of a transparent hugepage, soft-offline splits the + transparent hugepage into raw pages, then migrates only the raw error page. + As a result, user is transparently backed by 1 less hugepage, impacting + memory access performance. +- For a page that is part of a HugeTLB hugepage, soft-offline first migrates + the entire HugeTLB hugepage, during which a free hugepage will be consumed + as migration target. Then the original hugepage is dissolved into raw + pages without compensation, reducing the capacity of the HugeTLB pool by 1. + +It is user's call to choose between reliability (staying away from fragile +physical memory) vs performance / capacity implications in transparent and +HugeTLB cases. + +For all architectures, enable_soft_offline controls whether to soft offline +memory pages. When set to 1, kernel attempts to soft offline the pages +whenever it thinks needed. When set to 0, kernel returns EOPNOTSUPP to +the request to soft offline the pages. Its default value is 1. + +It is worth mentioning that after setting enable_soft_offline to 0, the +following requests to soft offline pages will not be performed: +- Request to soft offline pages from RAS Correctable Errors Collector. +- On ARM, the request to soft offline pages from GHES driver. +- On PARISC, the request to soft offline pages from Page Deallocation Table. extfrag_threshold =================