Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp43163ybt; Tue, 23 Jun 2020 14:51:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEju4lYL/b5ZaDfdJC/ufFKIH0oii7//Sx3MuPSfD95xVX7rUzTZifrSH3f5vfNtJMsk30 X-Received: by 2002:a05:6402:22b0:: with SMTP id cx16mr16723117edb.48.1592949104915; Tue, 23 Jun 2020 14:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592949104; cv=none; d=google.com; s=arc-20160816; b=HbczCflVGo9gEwla23Y3PGIFkeW7agjrdHqnzEZrJE9sjnEMnbVy1g6Gw8jV8aswoJ 9zPKBsaGqZ5bbbPyc+/OV/+8NMn3i9QPAG22AQArv9efAqtSD3o0kWiUDZoJJQjfTR6W p6cXyT9Qb3wvEM1GUpoon9iQTuyKmO7If+FPD4d5turroefj9nWOeBRhsaa0SMcvWHuZ O2HH0jsRfwyG6Zz4yyopImCpszEiRMenlyRZhn/EBwrC+xmSG/OXBeYk9g9hwbYWueFS 5IZvZrvrYs4zheM4t7cjD7HWoJXag9+IYExip1H9Zx0YtpftQLQ8L7Q9Lzd/HJ0ZQfZ7 pDaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=gLCkBZXPIIeY1g45tslFWO+PD0hc5lFZOqXooZUlWH8=; b=HcJZ5DxqEfnkpfkBcq8xvLfhWzmfP4Onf2bUp5bK0HCAZMfbzUjy3V4IFUoUNGdskY 7jQloaR5W577qmi4bDPis3ZHqNHCufhDblIuU640Hr1+a2X8HqMNw7SvhvQ2krWXV3Ms +AmkWhCrPk8D8PvbJBDDujREe3P3dqturtf+fbQ8qwD5SZNSbUJ6G+AkH2tdPGTmfh/Z SQhZsLZwbMJDYoP/IbFhoilbK2aX6NrCnmj76nG03hVqF+/CcNEXC4q1JAm0eAF+E6o9 /int0JeK3W19D/KEXLRAg0dRv0ZW2GdPO3lRmgNEKnqRtJPhgpHluSNDA9BFRsEmd1Ax wZpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PEpjg0qA; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p25si3106294edx.347.2020.06.23.14.51.21; Tue, 23 Jun 2020 14:51:44 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PEpjg0qA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387699AbgFWVsu (ORCPT + 99 others); Tue, 23 Jun 2020 17:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387455AbgFWVsu (ORCPT ); Tue, 23 Jun 2020 17:48:50 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40FDC061573 for ; Tue, 23 Jun 2020 14:48:49 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id ga4so252846ejb.11 for ; Tue, 23 Jun 2020 14:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gLCkBZXPIIeY1g45tslFWO+PD0hc5lFZOqXooZUlWH8=; b=PEpjg0qAPuLDlm5VvuUC6vrEb+6MoF8l1ACkYkcY2HqZwuoRNJMD27wb3HnDkODjtD 7kFpHy0BcQB2/OzA0cK5kmQTwI7kcUCl0JmvygO04JK875rulDjnePGKwoj5JnrZnKb+ ZjBmoLLWlGIZk7e19y2EEYvnIAHeQytiV1c+mF86BQpgvi5Zof6n4b3a3XpWN1YujICF TxQIIVKpvF/ldA5iEaPNRYG2kc84ZaWkO30cR9AOQ6GJcJ18KVDxU/sG006d4RdkMT2n hxkuTMg9n5Xe+jCG6LDOJrK7mqgBbra0811UUw7LXPpYU1ESywqo+8/7QWdTOi9s07wT 5RJA== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=gLCkBZXPIIeY1g45tslFWO+PD0hc5lFZOqXooZUlWH8=; b=tPzx4ks+zhTutBe/khrEl0q+C3ysy/INopNYNQXyjEcEGIKhq84EFKNzUP7ZeOZdhe 6oa98hf+rSW39afcAcaEqWmjY93iZZvcOYLvhY6jhgGcTmJfeo0IIVK6sYOJqXYZDNf/ MFkJ/+2ZdQlMgiaBofRcFnDnWuQ285fZpRtEX2Z/vMqxHgAPwPkW/vEtccWtmSnRmjz4 WxMioGr6Y9OSeklgVrG7TSVeWJDkkCf9k9umc57dTSnwkQWbq+nxMJ7ETp8Jb5dH+xjd mthkNLG1ItJQuMFdSnfKonAAtCT9ZIrgV0f8Cviv/vhsXPVW1vJEysPeMNwC4xXvLsea PEZA== X-Gm-Message-State: AOAM530tdn6mE12ztLjnpXGM//OC0aBcgWMMJ3B0hZ3k+E8WiDKOLbOq bDdfEdCegTx05oFL5xjAD/g= X-Received: by 2002:a17:906:4989:: with SMTP id p9mr23153743eju.417.1592948928712; Tue, 23 Jun 2020 14:48:48 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id j16sm15428301edp.35.2020.06.23.14.48.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jun 2020 14:48:47 -0700 (PDT) Date: Tue, 23 Jun 2020 21:48:47 +0000 From: Wei Yang To: Michal Hocko Cc: Wei Yang , 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: <20200623214847.fggchont44kgmvs6@master> Reply-To: Wei Yang References: <20200623094258.6705-1-richard.weiyang@linux.alibaba.com> <20200623151828.GA31426@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623151828.GA31426@dhcp22.suse.cz> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 05:18:28PM +0200, Michal Hocko wrote: >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? > I don't expect to have a non-section aligned system, so this is a theoretical bug to me. >> --- >> 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. > Like: /* Only depopulate sub-section memmap for non early section. */ Looks good to you? >> 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 -- Wei Yang Help you, Help me