Message ID | 20180523151151.6730-3-david@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5D5E360224 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 23 May 2018 15:13:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DF6B28FEC for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 23 May 2018 15:13:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C75328F2E; Wed, 23 May 2018 15:13:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E479929151 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 23 May 2018 15:12:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BCF36B02AA; Wed, 23 May 2018 11:12:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 947576B02AB; Wed, 23 May 2018 11:12:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79A2E6B02AC; Wed, 23 May 2018 11:12:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id 4D6F46B02AA for <linux-mm@kvack.org>; Wed, 23 May 2018 11:12:12 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id p126-v6so22801837qkd.1 for <linux-mm@kvack.org>; Wed, 23 May 2018 08:12:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=VP9VP/RSTeILUL2MJkIkPAVT0LFhVrltGnDzhFCQ2Bw=; b=cb5gG5nY5n9beP5iOvX2zB+Odau7CQuJ+nOsJOjr5wLAmwXUn1RkD1e51B0rN7if6C XdnVoMwITX7FZ/vSS0VR64wl4p9xgbGG2wnasEfOM1IzFuFM9SNBOGdKW3mb74kf4z11 FFllj4RbObG9w4dP6ZdUpl4WaShh/bnXcPEcNYQWg9I+GHFCfUmLnEybJliE3UxASPEI lRowkOj1LNIeoIJ1SzaL/h7qdNYtQTmV3xnp6FeXYjGGBvSFo3Xj+M9XjuJG9A3az7UH EIyDSPIgVdywOByxdzRMNqrbjTLClMb6Dkw2geoTImJzMvKLhXVCwkJ5N06usMYBhmi3 6hCw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: ALKqPwfQwNsaTtRtyth1hHF96tP33qqMyx7vneWEXM2JQVrRZL5Py7IV +49cE41QIGwJ5uKG+vpZZ9QUifen1r38UODk2nj6QGloj6V5zUCLt6reB3sX0ow4cI2N8y1TA/N 0untzm6PlcMZCTzpjwzEXqarCVAYzF9AQffbxYDpkTZpoSX+I95U2MSELYlPWBOuZXg== X-Received: by 2002:ac8:431a:: with SMTP id z26-v6mr3128838qtm.377.1527088332111; Wed, 23 May 2018 08:12:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ7YPLrP9WVJNQ131S6jNWFhXJfZtu+9GbXgOgerDGxWBzOkDxH7irU3ZGLHuA9Cminacxz X-Received: by 2002:ac8:431a:: with SMTP id z26-v6mr3128803qtm.377.1527088331597; Wed, 23 May 2018 08:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527088331; cv=none; d=google.com; s=arc-20160816; b=AK9UQ9UXTBnq5HnmLD5rDEwv4jAAaeICaJaWl/PiE3dreXn22smBgVHW5t3970MrnC HcSU0px7y1j882Gu+rPBihKhK9Z6+xwSsepJrbnzSudoMUsaRaLmRdHocYt21DxbAVzg ozpNfgIUa1VodsOK9CuoM0ZJgK809CPS5MaRqkikaTKCViYHVduGstPu4/753uMBVplP n2uI5Qi8lve8qLMiyzo8+CnE/oY0b1RIquykSsw7vi3H6vZjX751vODksXp4rmisGARa 3gZ+ZLzRrEH/yLxV8+MOd8t04iRzirTks/Bx4wZ3/S2CsZIGzXvF9hjsvSWbyn8MDm8r Mulw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VP9VP/RSTeILUL2MJkIkPAVT0LFhVrltGnDzhFCQ2Bw=; b=EUhhQRkacWra9k9CyDGudYspRi5w6i+wh3oqi+vmA8Pw6NbfJ3du5an/6Ii6wduZrT XPzQ5hYfl2gfQORhLj7A5oPf3P7CU1r+YjIOlP1Fj0/jCoqf2Dg5KfMBVVKm7ctRy930 P+b93W1SqNVWCGYjSBwyCenih6yAol7KKgbChft9dSHq7CNA5zO5JNGNbw/F51eEQSqm iBiOrTyctHY9hgk4xp+sSrDikWIYC2JqJHpSDXPJt5OSPoCU58W0dI92xQGy7DMZrMgk 3DLRwIePjcmql6q3IplU8p1uD1KbEMRF/FELeV52SQCLypEIssbAsPVX4gW/AEVppA8k aXcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id n23-v6si289552qtn.181.2018.05.23.08.12.11 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 08:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4C7FD4023112; Wed, 23 May 2018 15:12:11 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-112.ams2.redhat.com [10.36.116.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADE4910C564A; Wed, 23 May 2018 15:12:09 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>, Oscar Salvador <osalvador@techadventures.net>, Kate Stewart <kstewart@linuxfoundation.org>, Jaewon Kim <jaewon31.kim@samsung.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Subject: [PATCH v1 02/10] mm/page_ext.c: support online/offline of memory < section size Date: Wed, 23 May 2018 17:11:43 +0200 Message-Id: <20180523151151.6730-3-david@redhat.com> In-Reply-To: <20180523151151.6730-1-david@redhat.com> References: <20180523151151.6730-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 23 May 2018 15:12:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 23 May 2018 15:12:11 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' 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> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/mm/page_ext.c b/mm/page_ext.c index 5295ef331165..71a025128dac 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -320,7 +320,9 @@ static int __meminit online_page_ext(unsigned long start_pfn, /* rollback */ for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) - __free_page_ext(pfn); + /* still online? nothing to do then */ + if (!online_section_nr(pfn_to_section_nr(pfn))) + __free_page_ext(pfn); return -ENOMEM; } @@ -334,7 +336,10 @@ static int __meminit offline_page_ext(unsigned long start_pfn, end = SECTION_ALIGN_UP(start_pfn + nr_pages); for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) - __free_page_ext(pfn); + /* still online? nothing to do then */ + if (!online_section_nr(pfn_to_section_nr(pfn))) + __free_page_ext(pfn); + return 0; }
Right now, we would free the extended page data if parts of a section are offlined or if onlining is aborted, although still some pages are online. We can simply check if the section is online to see if we are allowed to free. init_section_page_ext() already takes care of the allocation part for sub sections. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Oscar Salvador <osalvador@techadventures.net> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Jaewon Kim <jaewon31.kim@samsung.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/page_ext.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)