Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5979019pxb; Mon, 14 Feb 2022 12:12:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDeZLEmbwd9fLPjQJ/EP5PdF/ZKY0jNprB/OWS+ikSgAY43IzBp+0kvzETmBOx/ojO7IMR X-Received: by 2002:a17:90b:1c0e:: with SMTP id oc14mr340009pjb.25.1644869544391; Mon, 14 Feb 2022 12:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644869544; cv=none; d=google.com; s=arc-20160816; b=iWdQOELsROVEbJNqprMyblaw08fa2+tbKG1jqfAgV/+upJcVsndNTqrrlqPQS+QwWJ 1lEJ20dz1OctBSlztdNegVSG6cKAnZOQ9L/xFA0TqTej+oIaUxcyF1NhiXc03E/EviBS RF5g3dSRv4eKgvJkcV8r0djWOgBw5SbjEMlmAqHaAApbFqFp2GG4KZgeptxu+vIhyh0D B1ZxWb3S5fivNKS9jXqF7uXuVZ1q6ySO83nWyqw4tEDpoM4y+eAZkMum/8VmYACOydl/ YHCsxWaF3uOSd2kLTkzdnobtxaIjatT0bdZgvITnoL0MLwv21Fpr+BkRrO4QQcw1r1/r /whA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IM8NeF/PLydFAbZlng4Zr5+zprwBGcL1n92uAaQGE2Y=; b=x0A6vnsxk47iHo0EoGz5t5WMRLCzsFvbMhYeHI9BNKzso1oLIiJlDLaY4Ygs49jnZz ueCgfOIyxHmSAOQ4eyNoYXhUhIAcEBGAOWpY33n+XpdKQYwi5+EMKUdSQPJUJMEsedEU JkIPZaWb/N7JfGFfsKkfI95+j4Pzj8zswGLmsJoaAm9UhmPn+h+kHBrFIq/JRSTiCvSJ gaobSpFZ0KP1qw1mXfIiSGqulp2WAeuWHMYohqDsEUWHmt0MlYSqEGfMm6OVd/hOnDOJ i1AUGeXMxL585A9Z9y8liyHj3bWGueTmtArOJDmgWGGBe6E5n1iyjIq0iOGgv0TwMpNd gmSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h3p/UZhw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s16si7397362plg.52.2022.02.14.12.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:12:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h3p/UZhw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B88CEF2131; Mon, 14 Feb 2022 11:49:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244449AbiBNJlt (ORCPT + 99 others); Mon, 14 Feb 2022 04:41:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244512AbiBNJke (ORCPT ); Mon, 14 Feb 2022 04:40:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59B0AB84E; Mon, 14 Feb 2022 01:35:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4BC92B80DC4; Mon, 14 Feb 2022 09:35:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 484DFC340E9; Mon, 14 Feb 2022 09:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831339; bh=nBbcmC2clBtFUE4+r3jUl7e4KKEhA/7ys6t+U2NjNkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h3p/UZhwvllCpW6/vcsFWwHMWWutb0MIAyND+y8rMsYg77PI7y2uq22K8kcxEuWBR Qb9hftZ+Ak/iXHrgW2fDce84P3AjDG1OpnliVRvT37eujxtqDmWdTckuUzOiaMQLLP Z5Qr+ngF4DY2J7AY1SEuzll+F5dm59yxNOl782ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Cezary Rojewski , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 22/71] PM: hibernate: Remove register_nosave_region_late() Date: Mon, 14 Feb 2022 10:25:50 +0100 Message-Id: <20220214092452.761290303@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092452.020713240@linuxfoundation.org> References: <20220214092452.020713240@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Amadeusz Sławiński [ Upstream commit 33569ef3c754a82010f266b7b938a66a3ccf90a4 ] It is an unused wrapper forcing kmalloc allocation for registering nosave regions. Also, rename __register_nosave_region() to register_nosave_region() now that there is no need for disambiguation. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- include/linux/suspend.h | 11 +---------- kernel/power/snapshot.c | 21 +++++++-------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index cd97d2c8840cc..44dd49cb2ea05 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -428,15 +428,7 @@ struct platform_hibernation_ops { #ifdef CONFIG_HIBERNATION /* kernel/power/snapshot.c */ -extern void __register_nosave_region(unsigned long b, unsigned long e, int km); -static inline void __init register_nosave_region(unsigned long b, unsigned long e) -{ - __register_nosave_region(b, e, 0); -} -static inline void __init register_nosave_region_late(unsigned long b, unsigned long e) -{ - __register_nosave_region(b, e, 1); -} +extern void register_nosave_region(unsigned long b, unsigned long e); extern int swsusp_page_is_forbidden(struct page *); extern void swsusp_set_page_free(struct page *); extern void swsusp_unset_page_free(struct page *); @@ -453,7 +445,6 @@ extern struct pbe *restore_pblist; int pfn_is_nosave(unsigned long pfn); #else /* CONFIG_HIBERNATION */ static inline void register_nosave_region(unsigned long b, unsigned long e) {} -static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } static inline void swsusp_set_page_free(struct page *p) {} static inline void swsusp_unset_page_free(struct page *p) {} diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index d65f2d5ab6942..46455aa7951ec 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -945,8 +945,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) * Register a range of page frames the contents of which should not be saved * during hibernation (to be used in the early initialization code). */ -void __init __register_nosave_region(unsigned long start_pfn, - unsigned long end_pfn, int use_kmalloc) +void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn) { struct nosave_region *region; @@ -962,18 +961,12 @@ void __init __register_nosave_region(unsigned long start_pfn, goto Report; } } - if (use_kmalloc) { - /* During init, this shouldn't fail */ - region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL); - BUG_ON(!region); - } else { - /* This allocation cannot fail */ - region = memblock_alloc(sizeof(struct nosave_region), - SMP_CACHE_BYTES); - if (!region) - panic("%s: Failed to allocate %zu bytes\n", __func__, - sizeof(struct nosave_region)); - } + /* This allocation cannot fail */ + region = memblock_alloc(sizeof(struct nosave_region), + SMP_CACHE_BYTES); + if (!region) + panic("%s: Failed to allocate %zu bytes\n", __func__, + sizeof(struct nosave_region)); region->start_pfn = start_pfn; region->end_pfn = end_pfn; list_add_tail(®ion->list, &nosave_regions); -- 2.34.1