Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp755480rwb; Tue, 27 Sep 2022 04:21:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/mQbX9+GrOOgU3+nW2T420BASXjvJTQECegyBf5wBBpimo2MraYZn9QicNnsFalmMlVvp X-Received: by 2002:a65:6e97:0:b0:439:e6a3:9f6d with SMTP id bm23-20020a656e97000000b00439e6a39f6dmr23783020pgb.369.1664277705971; Tue, 27 Sep 2022 04:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664277705; cv=none; d=google.com; s=arc-20160816; b=qKrPice5kBrGpMH7cKZiINGSNs5YXFOK3RNanngCphd/WcG6iKMVmJrgTI814TuDya 7vOaINC1MuI3AOJGKd6tmuT3M5hRltzwYCymfP5JhDlalveN0JMHczD8E17HzU/kV5u1 KHhRl7TE7a28dxpoAZqfcPzxW6rAWGzD9YoFI0pmqhy3pGSa+aGSlErxYEwiKqEkf5dY Fp0kyI5lphiOH6WdQa55mResP+vDGHxhoSWsIDartYLIdKq1pLrZGp3wLFAukIuWezn8 sUb6Q9d5w2MLL6hYeUcDZbRtErgTbnY4wKZlEYVuD9Iy06IjFQ3KgXB97+cyb8SMv2vi tR6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=p20OR+6/iIoYzZCNDyYXhWWTGqXazXK2HVN3vpF05jw=; b=HnEx03o8rV/bOkZDV3FYfd7qr/yrULoP85w844UGEUx1qDMYrAnPO1KpJszUZg9pKU 7bEYBPO6wx5SGdNBGpCSkphlWAYgULNVB7yMargIqILgpKlFJkSWYWTwyhhLVIZ0obf/ V5WEohkg9hy1fJuHq4r1rYi2Qtlag82f3qZWEmBLpgkyhmRTxI0QVd/7I7rk62RLobJR 3Pz56gyJN65JMF6+//dGCVdgtrBtHeqYA6tw2Q5qtE3fJBycHFQ6XhSzCcC4jDnjPWNw lCWI4IjhOXsGd77QDBQ5Kz2fuyBUBpZ3ySpxhmxJFpWtixDfCWb06jivazk9CiW3RsWW CtrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a056a00080900b0053848a57f85si1885396pfk.277.2022.09.27.04.21.34; Tue, 27 Sep 2022 04:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbiI0KeN (ORCPT + 99 others); Tue, 27 Sep 2022 06:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbiI0KeJ (ORCPT ); Tue, 27 Sep 2022 06:34:09 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A5783C8D9 for ; Tue, 27 Sep 2022 03:34:07 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4McGBs39yRzHqMZ; Tue, 27 Sep 2022 18:31:49 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 18:34:05 +0800 Received: from ubuntu1804.huawei.com (10.67.175.30) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 18:34:04 +0800 From: Hui Tang To: CC: , , , , Subject: [PATCH] mm/hwpoison: fix build error without CONFIG_MEMORY_FAILURE Date: Tue, 27 Sep 2022 18:29:46 +0800 Message-ID: <20220927102946.98622-1-tanghui20@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.30] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Building without CONFIG_MEMORY_FAILURE will fail: mm/memory-failure.o: In function `action_result': memory-failure.c: undefined reference to `memblk_nr_poison_inc' mm/memory-failure.o: In function `page_handle_poison': memory-failure.c: undefined reference to `memblk_nr_poison_inc' mm/memory-failure.o: In function `__get_huge_page_for_hwpoison': memory-failure.c: undefined reference to `memblk_nr_poison_inc' mm/memory-failure.o: In function `unpoison_memory': memory-failure.c: undefined reference to `memblk_nr_poison_sub' mm/memory-failure.o: In function `num_poisoned_pages_inc': memory-failure.c: undefined reference to `memblk_nr_poison_inc' Add CONFIG_MEMORY_FAILURE wrapper for invoking memblk_nr_poison_{inc|sub}. Fixes: 69b496f03bb4 ("mm/hwpoison: introduce per-memory_block hwpoison counter") Signed-off-by: Hui Tang --- mm/memory-failure.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 03479895086d..5bb9d2d20234 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -77,14 +77,18 @@ static bool hw_memory_failure __read_mostly = false; void num_poisoned_pages_inc(unsigned long pfn) { atomic_long_inc(&num_poisoned_pages); +#ifdef CONFIG_MEMORY_FAILURE memblk_nr_poison_inc(pfn); +#endif } static inline void num_poisoned_pages_sub(unsigned long pfn, long i) { atomic_long_sub(i, &num_poisoned_pages); +#ifdef CONFIG_MEMORY_FAILURE if (pfn != -1UL) memblk_nr_poison_sub(pfn, i); +#endif } /* -- 2.17.1