Message ID | 1617140178-8773-14-git-send-email-anthony.yznaga@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=RqBk=I4=kvack.org=owner-linux-mm@kernel.org> 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,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 1F3BBC433C1 for <linux-mm@archiver.kernel.org>; Tue, 30 Mar 2021 21:26:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B86CE6195C for <linux-mm@archiver.kernel.org>; Tue, 30 Mar 2021 21:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B86CE6195C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 057676B00A0; Tue, 30 Mar 2021 17:26:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 006E86B00A1; Tue, 30 Mar 2021 17:26:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D72086B00A2; Tue, 30 Mar 2021 17:26:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BB4BB6B00A1 for <linux-mm@kvack.org>; Tue, 30 Mar 2021 17:26:43 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8617352AA for <linux-mm@kvack.org>; Tue, 30 Mar 2021 21:26:43 +0000 (UTC) X-FDA: 77977825086.36.D59BB94 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf10.hostedemail.com (Postfix) with ESMTP id 5849440002C4 for <linux-mm@kvack.org>; Tue, 30 Mar 2021 21:26:42 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12ULNwtB130351; Tue, 30 Mar 2021 21:26:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=eeHURyy6hU/3vomeUrsOPdCqibZVdiCRAeYgF62OlGM=; b=QSrWre0+MIaGCYOU7+DJTMuBtk1cCPaiJRKhxW1tqrX3bcQBF+TTbbU6t/6iOBzNDPnj vztSlfCHq4Txv0PJ2GZJHIYVQGir71OFWZKpbOTIh7d5YKsVQh5mOqqYWR2JxmGmEb1y umPXNnmXMS0kHClYO5KAsVsaTT+k+JBedfDQZaYJ9eaiUoNbWZWdtjX+nzp5l/ZOqdtD ReUAHbyz2lHs7Gs+euUUmgl7ViQTSQAFJd/UBIn8rPVunIG0ccbIY2Dyg+W0ri3rgF57 YJjtXKoSRtR9a2r+IfFHDLTlRzUu14/s4NGce5RkSNwX+OOjwc7LOaVhvfTmyldrn+3g HQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 37mabqr8ng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Mar 2021 21:25:59 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 12ULOabo149644; Tue, 30 Mar 2021 21:25:59 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by userp3020.oracle.com with ESMTP id 37mac4kdf6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Mar 2021 21:25:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKUSpQ+EW9A912TSdp4d10GvOF1n0NrPiThg2sVY+dbNLuwiKEWZf61yJ5CsnO/f7FgMLlyLMXzdBo3MWcN/IBBHjsBWl5X3u9hgel62nLuhoHErN6OFvHSkv+OHalzowOcogkPVzBf48V9aXT3rXBl6PfV3wSZ53ANimY971lPXu2QMAvPcnHZ8ezU3hVf9pxWHVqxmeOa6RCtehm87QO9sB/I+ZJoeY2/vViC8trW7xOTWS3AdnlIzQOdzFydvITlsiJXtu3e6U2TFET4C9sEJe3iSmOi03fWnSiuVGWAzdPdKeZJka3ShaXQ0bfxvJJwK0IpSv5MfqdrTWP5VUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eeHURyy6hU/3vomeUrsOPdCqibZVdiCRAeYgF62OlGM=; b=MZUg1q1nmj74OSKK94hp4a8fJIkI68RqDgUy5b8qkJcWsVCP2duQT6fuIKC4G/xYggH4YZYn+OT1geQy1pcxqq5JcpoeMwyxxlbw0h6q0PWaAPahige2a1anRv9VTr9PY78GOkdxv5ZWNxEtuTKiGkcb3ilYfXgg41HLff7BpoqOywOoexmyUzkdxSbwwdF8JaG1QVCOplSgWO6fFlI4lefpKU0C9CrWCpX5ezo9X8xRcdNBhm+SxTp50nvuN4NfrlkCbLq9QNlBxtnPQwWGVeQBtdNzcEkuZJJGJRXPfB7o2nBo5QOZ+QYEN6P7oESJDR5XUzDzGX2U7zrIwyNUkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eeHURyy6hU/3vomeUrsOPdCqibZVdiCRAeYgF62OlGM=; b=F9rBjMUrlIgbbeJbR4vWmLqfFwoe7LDUAT1NvP3k9u2EaPV1xrZGQ6T8ZXNEzAVemW0U1yJiq3bQ8sF8lKz1bbKJK1eIbELHRvrN33r81Ds+j1Q8hE4ENS7VLqtwLdDf6l736aZvYKsyXG6PUaC2lga/4BAysMsjigeGVgqCuTs= Authentication-Results: kvack.org; dkim=none (message not signed) header.d=none;kvack.org; dmarc=none action=none header.from=oracle.com; Received: from MN2PR10MB3533.namprd10.prod.outlook.com (2603:10b6:208:118::32) by MN2PR10MB3613.namprd10.prod.outlook.com (2603:10b6:208:115::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Tue, 30 Mar 2021 21:25:56 +0000 Received: from MN2PR10MB3533.namprd10.prod.outlook.com ([fe80::cc79:c40e:430f:e254]) by MN2PR10MB3533.namprd10.prod.outlook.com ([fe80::cc79:c40e:430f:e254%4]) with mapi id 15.20.3977.033; Tue, 30 Mar 2021 21:25:56 +0000 From: Anthony Yznaga <anthony.yznaga@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, rppt@kernel.org, akpm@linux-foundation.org, hughd@google.com, ebiederm@xmission.com, keescook@chromium.org, ardb@kernel.org, nivedita@alum.mit.edu, jroedel@suse.de, masahiroy@kernel.org, nathan@kernel.org, terrelln@fb.com, vincenzo.frascino@arm.com, martin.b.radev@gmail.com, andreyknvl@google.com, daniel.kiper@oracle.com, rafael.j.wysocki@intel.com, dan.j.williams@intel.com, Jonathan.Cameron@huawei.com, bhe@redhat.com, rminnich@gmail.com, ashish.kalra@amd.com, guro@fb.com, hannes@cmpxchg.org, mhocko@kernel.org, iamjoonsoo.kim@lge.com, vbabka@suse.cz, alex.shi@linux.alibaba.com, david@redhat.com, richard.weiyang@gmail.com, vdavydov.dev@gmail.com, graf@amazon.com, jason.zeng@intel.com, lei.l.li@intel.com, daniel.m.jordan@oracle.com, steven.sistare@oracle.com, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, kexec@lists.infradead.org Subject: [RFC v2 13/43] PKRAM: free the preserved ranges list Date: Tue, 30 Mar 2021 14:35:48 -0700 Message-Id: <1617140178-8773-14-git-send-email-anthony.yznaga@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1617140178-8773-1-git-send-email-anthony.yznaga@oracle.com> References: <1617140178-8773-1-git-send-email-anthony.yznaga@oracle.com> Content-Type: text/plain X-Originating-IP: [148.87.23.8] X-ClientProxiedBy: BYAPR11CA0099.namprd11.prod.outlook.com (2603:10b6:a03:f4::40) To MN2PR10MB3533.namprd10.prod.outlook.com (2603:10b6:208:118::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-qasparc-x86-2.us.oracle.com (148.87.23.8) by BYAPR11CA0099.namprd11.prod.outlook.com (2603:10b6:a03:f4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26 via Frontend Transport; Tue, 30 Mar 2021 21:25:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23a80e4c-b305-4445-a0bb-08d8f3c26792 X-MS-TrafficTypeDiagnostic: MN2PR10MB3613: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <MN2PR10MB3613B04F95EBDB2394090A27EC7D9@MN2PR10MB3613.namprd10.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1PE7Yw5MNyJHxnEnAc5AjN82fZVNWb8BOpGZY3xByCbLkBlvYkUL41j5GH7jbsIYdNVDww039qzbXdrTHkJQ5ob5OHW1TYQ6qbvQIYiXuMwCtulC8Z7b4CNHojeypotssNnEDyu4ACWFaL9pRtPsrcGm+W20zcaAlYmluc4tiGO69qsE6erZFY4wiGQDNNWXufxMfnpjswbpdqpEprx2WwRM7HcHs2B5PxuPp67momuixcxseeFRUuD4HjuVSlNMygnftmAF1OyGeOG55ty/rzskENTt3ugy7bdbwn3Td4jiRRywJZmHbCfNhimMoggD8GLTgenkFTYdSe3ZdbyU/sXEdX0j8eqt7h0v/z+nDPNpRriHGQyl4WQdov1LSMOwO9yQJiM2JluPF38aZFE23Bg+WTjxMMbYAIsOs252WyHRdtNb5GSjebgEJrSaAm2AhSei9GH6O7zRHXBxl/NIqcQbdLNwoOB9/+5D6RnpxEVpMJFOyZ0XfAs90JD+qhtfWCYWNs8uzZmVeQ8fTv2zh8/oInyB0ru23Jx5Hl770rS1Tk9YklgLl5VoZ6uAvE4+YmLNgP69LF7TQpDEaM9ja2IGgwS7FTq5wBq3A3k/+vw2MP8QBSiD/NWxsPbA1OVtOaWF3b2YZeewDVMB+iTYAw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3533.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(346002)(366004)(396003)(136003)(376002)(8676002)(26005)(44832011)(5660300002)(8936002)(4326008)(7406005)(52116002)(956004)(186003)(7416002)(7696005)(6486002)(66476007)(2906002)(16526019)(66946007)(478600001)(38100700001)(36756003)(86362001)(6666004)(66556008)(316002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eKzezh391nQqclYQXW7aLROI7q3saKoon9xplGDNOp4OKubJkOm5uGvnUR0T1y54hNKInZlK5j39AGVKq1jSyy3SEl7/CHG5cTONUB/CqTPLio27BNu+5AIHaXgB86G3QfeJsJt28OmU92TcbjVFwfBm6QGFNvSIpXVCVFjiMIrQKvCMdQgNcBgPiS+HvzQwokOFH3tLbZetSd/lEGW0mG01VW/s4H7+RL8ZgS1SC14eDHbla1IOCI597987ghDQI6YBsm8GBYO7jO1TPR00qEd1HM1+3x0uFW2mbaJVA43aknChzVY90MIxCrsvut2gXJlNrynIK0gFOb4CKnKy0CHOl3yk5250askx8CcYT1DvImBAqJLI8MRh/8wYdiobjQpIYOIXz8X4NlN0ge4DZU6rc9pGcJpuWrqhSl6v7rjCzeW9gPLIhuVyjXBbTbepESZwLI5ogblD8B9YBm5MbI6SePeu0TbNZLNbU+nk63/NlLVCo7OjLAlfjop7FaG7sl5PLiZM9P763JPMTVes/mzHk0Ad6nxzHD+V6DRI2Wqy85y0HWo4XO2NQeaadPvW4FEDWyiDyKkSdxxgnPuUzAdxqBIB7u1mX+ZNWv+KJx35spU6prKTdMXx/IIxtWpsWGxxnXCh7Z+ce+fQLmHAgG8fMJ3w1jVSGQ6RYzNm+/H0SvWNx6hmyWZfw87QGV3t451i8u779U7oAVdORcU3/EhoMWKKzX0NAJ41JJ5TDSAp66qioZ4BRIEbP1pcRuyl++rEkcOLAYY6Jg8bI+ssNisDJbPVM4a6vt8Zvpk2ik14U23NMGQc9A33jeSzPe5MJn4s9TPOuJJakJauRgNAqHrlqqryrBYFb39HWhnc3dnPqQK04e9PWv4v/KmqqaxafBTpN96QgnAR51GvHnG6cUDrB9j2v4Ya3GA8HBvztZSIYKjhSq1j6ZGKN8VXV7Vcu/oNFw7cWAgbiv65xiILsvquP5SwLSgu6X3pwAKNLyhKSycLQ5BXW5kN+LGjSZghemHg/BVo3LAhH2WDLjXthI8Aa6Wko9CzSViwgLYhoofha9A1j9LUaZKOms988wGtoUwZeakVGw3NCxBPwBx90PIdg7Y5j10AI7d9VxPpZhv5H9QrMxfxqcg1KGCf58h+LhtgiEbs7VrJLwdisuf4ZIKq2bS+Rhzouu3rcXFCAJRi3VD61gscuKnVWgeNcVT9vV0M559KQfgTLvteJSn/KDmlzRBH2DnGXGOeGxoOcgAA8vEH73KmmfYuLCwSCHokTwflsVuCVtqrRmdAoEpReRZmKhvDnQD+racFoNHwe8kS4WVkoV1uPR0b3U/mCN90 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23a80e4c-b305-4445-a0bb-08d8f3c26792 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3533.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2021 21:25:56.1311 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ifa1kZL4zsZfIJkd/5wl6ZsDyg18LpL0kpGle0UYcTzWwESp0KWVwxzlopp3H2ivz9BBJHpzUvgG0vDj7B22qcAeUxOcBqSYWyjEim/F8gE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3613 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9939 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103300000 definitions=main-2103300156 X-Proofpoint-ORIG-GUID: Pe5kuM0osdDCsxlB-Tn1S0aXPdH9LAEe X-Proofpoint-GUID: Pe5kuM0osdDCsxlB-Tn1S0aXPdH9LAEe X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9939 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103300000 definitions=main-2103300156 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5849440002C4 X-Stat-Signature: qwr8adi85cgwnqfmmfk9gj1rc8sooesn Received-SPF: none (oracle.com>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from="<anthony.yznaga@oracle.com>"; helo=aserp2120.oracle.com; client-ip=141.146.126.78 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617139602-434585 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: <linux-mm.kvack.org> |
Series |
PKRAM: Preserved-over-Kexec RAM
|
expand
|
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 8efb2fb2a88b..69bd71996b8b 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1294,6 +1294,7 @@ void __init mem_init(void) after_bootmem = 1; x86_init.hyper.init_after_bootmem(); + pkram_cleanup(); totalram_pages_add(pkram_reserved_pages); /* * Must be done after boot memory is put on freelist, because here we diff --git a/include/linux/pkram.h b/include/linux/pkram.h index 8d3d780d9fe1..c2099a4f2004 100644 --- a/include/linux/pkram.h +++ b/include/linux/pkram.h @@ -102,9 +102,11 @@ int pkram_prepare_save(struct pkram_stream *ps, const char *name, #ifdef CONFIG_PKRAM extern unsigned long pkram_reserved_pages; void pkram_reserve(void); +void pkram_cleanup(void); #else #define pkram_reserved_pages 0UL static inline void pkram_reserve(void) { } +static inline void pkram_cleanup(void) { } #endif #endif /* _LINUX_PKRAM_H */ diff --git a/mm/pkram.c b/mm/pkram.c index 03731bb6af26..dab6657080bf 100644 --- a/mm/pkram.c +++ b/mm/pkram.c @@ -1434,3 +1434,23 @@ int __init pkram_merge_with_reserved(void) return 0; } + +void __init pkram_cleanup(void) +{ + struct pkram_region_list *rl; + unsigned long next_pfn; + + if (!pkram_sb || !pkram_reserved_pages) + return; + + next_pfn = pkram_sb->region_list_pfn; + + while (next_pfn) { + struct page *page = pfn_to_page(next_pfn); + + rl = pfn_to_kaddr(next_pfn); + next_pfn = rl->next_pfn; + __free_pages_core(page, 0); + pkram_reserved_pages--; + } +}
Free the pages used to pass the preserved ranges to the new boot. Signed-off-by: Anthony Yznaga <anthony.yznaga@oracle.com> --- arch/x86/mm/init_64.c | 1 + include/linux/pkram.h | 2 ++ mm/pkram.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+)