Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3686365ybt; Tue, 23 Jun 2020 08:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3cLhdkAlfgATF+CIGFpxG2OunNT8xdkWpKdRXeDSjeJjT4AoH22MdIgbJQOvGfYy+S+hZ X-Received: by 2002:a50:cfc4:: with SMTP id i4mr21976344edk.252.1592925785899; Tue, 23 Jun 2020 08:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592925785; cv=none; d=google.com; s=arc-20160816; b=nx/BqmX+oY6nn/cGfrfVs/gjijDQsYs4jO0AxjECZiMt+z91seki8bmyX3GUfWmUBf xSDkjeWoSaZDOkv2IJLs1KpHGfr3pseLdq3SempntHF+bUZvDWhOOL2fV0hFOPI33pfJ dwawz/K7X0ntUHLXOU1rY7w7OuGmoHur7hsS2gjdj5ho0B0FqvgMQkEwMvTVDSf0JjMy JeHWA/RTksi25Yi2hmkf1XQwrFRWfl9LNAWQKUNY1T3thlsXA/2qZCJ5DRTWlfs0ughY lF41AU9bBTOu6EhC3HZLmLeesdAnToc1MQFKWzSES3V74ulZvlw5ePxxW0cokk+jqKVU xkmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=MvVMGC38xXiscRPFSdMMDf6uiRQWRRdbs+WbHzNkqzw=; b=icvWFz89Vp0ksPg3uryD4NZhydkO1dG8VJuZugbWvbJYv0k3CV07Mn27B7eWuFxmYC Wu5jdjcVpTOD/G1I19QS5+mx2sp0hqiMZk1NU3GAYaiIxXv2jMd4Ffh4VOk7fX7KVybh UgUWpgsoH/UgIS0F1IoPUE3WEGFn2ZWGbqDB/7ns6IGHdi6DymAqPSQEdVQW0cSptKzs KPLQGIym7S0vOpl/vRv9zTtdRVaLXBwD7cof3gzA+1r47BRHoEaOV2cgEm7EwVFLTm1s fnZgD1CAFajiuLy/G9lxh0bFDZbsdyxcDeIz5xoMRYAtmETIozZC1aD6IP5bdssmapxo XXbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si3140848ejx.656.2020.06.23.08.22.42; Tue, 23 Jun 2020 08:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732970AbgFWPSf (ORCPT + 99 others); Tue, 23 Jun 2020 11:18:35 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41265 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732878AbgFWPSe (ORCPT ); Tue, 23 Jun 2020 11:18:34 -0400 Received: by mail-wr1-f66.google.com with SMTP id h15so991649wrq.8 for ; Tue, 23 Jun 2020 08:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MvVMGC38xXiscRPFSdMMDf6uiRQWRRdbs+WbHzNkqzw=; b=mvcbLclUJfFUeAvRzmTBFgM82c2Jy48h4Oc5pf7l0ZgHdDVQCaEqvu4gzjkFXTH/fO nYbVfeYebeSVOL47ZYZ0/r5EwndbADztyXCKvGtFbH3ldWXiFr8klo7/pa0PUn1YY3ws UmcbwqcaQFDBY0wEU7/N/y6HlSUkiLuNKZGf5pxQXagANxRLvInVDn92cyLkyjQr/SpP YvYQMF3EyuDOpKqRtGO2DKkbs0UA1d6lrtH1r4xUXAONMUQkYO/5TuHxa1QX/ymd2EXO MsI6OLl6k+0ebKxyLFfBRsR6otDGTbzL4BhSVupQudkEjt5jxrqadfd5nsVK7tN8sV06 JO3w== X-Gm-Message-State: AOAM530kl7oTWXSai1sUieU/hJmQfWt396/AHYHlsTqnrQv5tVADy6sa U/3DkCcvUA1kjDFX4HPdwbG4FYN8 X-Received: by 2002:adf:fd41:: with SMTP id h1mr26516448wrs.374.1592925511338; Tue, 23 Jun 2020 08:18:31 -0700 (PDT) Received: from localhost (ip-37-188-173-135.eurotel.cz. [37.188.173.135]) by smtp.gmail.com with ESMTPSA id g3sm25628896wrb.46.2020.06.23.08.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 08:18:30 -0700 (PDT) Date: Tue, 23 Jun 2020 17:18:28 +0200 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, osalvador@suse.de, dan.j.williams@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@redhat.com Subject: Re: [PATCH] mm/spase: never partially remove memmap for early section Message-ID: <20200623151828.GA31426@dhcp22.suse.cz> References: <20200623094258.6705-1-richard.weiyang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623094258.6705-1-richard.weiyang@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 23-06-20 17:42:58, Wei Yang wrote: > For early sections, we assumes its memmap will never be partially > removed. But current behavior breaks this. > > Let's correct it. > > Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") > Signed-off-by: Wei Yang Can a user trigger this or is this a theoretical bug? > --- > mm/sparse.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/sparse.c b/mm/sparse.c > index b2b9a3e34696..1a0069f492f5 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -825,10 +825,10 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, > ms->section_mem_map &= ~SECTION_HAS_MEM_MAP; > } > > - if (section_is_early && memmap) > - free_map_bootmem(memmap); > - else > + if (!section_is_early) This begs a comment. > depopulate_section_memmap(pfn, nr_pages, altmap); > + else if (memmap) > + free_map_bootmem(memmap); > > if (empty) > ms->section_mem_map = (unsigned long)NULL; > -- > 2.20.1 (Apple Git-117) > -- Michal Hocko SUSE Labs