From patchwork Wed May 26 23:52:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 12282965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30506C47088 for ; Wed, 26 May 2021 23:53:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C2D47613D3 for ; Wed, 26 May 2021 23:53:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2D47613D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 079026B006E; Wed, 26 May 2021 19:53:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 001D16B0071; Wed, 26 May 2021 19:53:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D97018D0002; Wed, 26 May 2021 19:53:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id A1A486B006E for ; Wed, 26 May 2021 19:53:15 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 10CF0181AF5C4 for ; Wed, 26 May 2021 23:53:15 +0000 (UTC) X-FDA: 78185035950.12.B488551 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf12.hostedemail.com (Postfix) with ESMTP id 98C052CC for ; Wed, 26 May 2021 23:53:04 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id t21so1433123plo.2 for ; Wed, 26 May 2021 16:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6mXh3c9ZB/hAxTDKi9fynEz6oh8bZIstdzjsb0THY5o=; b=EEcT3ELNsQ9vVEUmHaT6Fa4RSd8lyVpze0AAw0NaoV8UlTeYSkXrowFBfeSw003bzT 4wvYDwpw/1KIRfUqx9GkAenx7vcAXYKis5a75qsisnIo8TFtMEqMA/YK1u10buvAfRGo bUm5hGexCBBUK1adtCWh7Lo1eUz0fTMA8oElEj1EFtoHCnKSBiOL0pYz+o1SjarwRW+i daukyuJwLIfW9Ic6jDeuPPeJavzffWMZpGdJZzsIAjKosil0u36vFIczG7yEZWPu1J1h 1DvQk8EPgeDjHsIP0JOHxqRmIkCPsVkeNjSgJqpzdISriOsnBUCjQaoNDoOm+A9lq5vh /PVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6mXh3c9ZB/hAxTDKi9fynEz6oh8bZIstdzjsb0THY5o=; b=SF1/EOdUDW49iAlUxwtBLmwVi4GiAZNkBqmJMCkHQGlIQ9C6C/3KU4tYP4eMCHgAao +9Rh4aTmo9woaI7UIkBDNww7MbN4apFyv5tsQgilXOLFi5Re5wqcbrZo3/66muWSfAcB 7/jsWcu08y/ttPgvLEKTeMHfhrGgtlTylHyKJ1LUfN3Ccnc/bDybR4VAb5zTbmJ4WY0K BzUrNRpoNtFQyTwAuKeJ3+q8quIOC6q/HKwzeqF2bH/Q2ENAuMxP0tUz8cMXrL+tW730 45ANztXSzHg7AMP8riXlqCYiEd16bLU1K+zYJTuS/Aad57NAQMjfi31zSZz+LLQYw/Wq tCsQ== X-Gm-Message-State: AOAM533C0JyEQjr7CT2GtPH924cff4nNmhgBGzvwblEwoOwImYqzrAqD grpZXbwuF4JN2KrK6fEBjWO2saJukQgZ X-Google-Smtp-Source: ABdhPJyOdrOvfLiJxE/Lds0YBYaFooytCDXCqmFsBU7kwDmrQ0AgYeRWG+3FWq7Rmmj5obrZjkBu/w== X-Received: by 2002:a17:902:b683:b029:ee:f0e3:7a50 with SMTP id c3-20020a170902b683b02900eef0e37a50mr610607pls.7.1622073193498; Wed, 26 May 2021 16:53:13 -0700 (PDT) Received: from localhost.localdomain (h175-177-040-153.catv02.itscom.jp. [175.177.40.153]) by smtp.gmail.com with ESMTPSA id 10sm177063pgl.39.2021.05.26.16.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:53:13 -0700 (PDT) From: Naoya Horiguchi To: linux-mm@kvack.org, Mike Kravetz Cc: Michal Hocko , Oscar Salvador , Muchun Song , Andrew Morton , David Hildenbrand , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1] hugetlb: pass head page to remove_hugetlb_page() Date: Thu, 27 May 2021 08:52:57 +0900 Message-Id: <20210526235257.2769473-1-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 98C052CC Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=EEcT3ELN; spf=pass (imf12.hostedemail.com: domain of naohoriguchi@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=naohoriguchi@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam04 X-Stat-Signature: ktmjgm435cqnh5qxpscjpt3ywesumkoc X-HE-Tag: 1622073184-665761 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Naoya Horiguchi When memory_failure() or soft_offline_page() is called on a tail page of some hugetlb page, "BUG: unable to handle page fault" error can be triggered. remove_hugetlb_page() dereferences page->lru, so it's assumed that the page points to a head page, but one of the caller, dissolve_free_huge_page(), provides remove_hugetlb_page() with 'page' which could be a tail page. So pass 'head' to it, instead. Fixes: 6eb4e88a6d27 ("hugetlb: create remove_hugetlb_page() to separate functionality") Signed-off-by: Naoya Horiguchi Reviewed-by: Mike Kravetz Reviewed-by: Muchun Song Acked-by: Michal Hocko Reviewed-by: Oscar Salvador --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git v5.13-rc3/mm/hugetlb.c v5.13-rc3_patched/mm/hugetlb.c index 95918f410c0f..470f7b5b437e 100644 --- v5.13-rc3/mm/hugetlb.c +++ v5.13-rc3_patched/mm/hugetlb.c @@ -1793,7 +1793,7 @@ int dissolve_free_huge_page(struct page *page) SetPageHWPoison(page); ClearPageHWPoison(head); } - remove_hugetlb_page(h, page, false); + remove_hugetlb_page(h, head, false); h->max_huge_pages--; spin_unlock_irq(&hugetlb_lock); update_and_free_page(h, head);