Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1354236ybl; Wed, 14 Aug 2019 15:33:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9D73Dvn8Q+/jA/VPKhny3ZtJdbOHLlOvBBprOfDbxJcAdQG3k6Ev2GoQnuFCgdBDxT/FU X-Received: by 2002:a17:902:760e:: with SMTP id k14mr1478035pll.161.1565821981206; Wed, 14 Aug 2019 15:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565821981; cv=none; d=google.com; s=arc-20160816; b=d0mwZEm43yg02qmsAEa7vFPPSUY7zGuMHG8dwjnOgw9xfvOAK1tJDDUj9vuTT+Boxe 9gtZU7b/PrEICmMVdi1OVjXwwQKDMFomJnfmQw9SM/oKqYjH94pr+eJTaPQCI6+8dsOq OZ33GYaTinoEMLkDPmAB5cRNtz316c5i+acIfO7zv28xPgaR5ov0MOaAwkM7sTJwjqjF NcN8FLbJ82Sa1O9QVGQjR8tg3TqjMpRBg8scq6/anPWz09E42ZaS3svSKRvfK7YcuYDs wEVYsfAASamTyVuN+xkzCdniz5HCF+AsdmX4l6o2EXqJuvOsscHPaGPcGQ5A6TLONykZ kBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4PD/0vn0dREH1b5tV0NzbSskqlACF3WMQPW/mZx7auc=; b=KNLp+PPPCMY3oX39yX44urefd43unmsarIjOS+S8HejxQhgckGVAQ6Dc7u60x9EORb dy028EjMnNFbeaazUvy413IqPvGuTBC/v4ZMoebnmctle4kJrhSWdC0/OyhOpfZXiXkM SJyp2QyDWZjySdlbReGY0lwlMGayi7MWUSTrkpbDR+HGh8MXjf7920Ia8D1pwziL/ZUr neUYvPDtH6ldNRNeL++04e2zcg5vIPviWFF4FkK12q02iXmNUqtI+QiT2lrwl6YP50+Z 6Ijb1KUNnU7p/DcJs/x85B1JcwQK4f7Rbc8VheGA4SZ4OCWGu4dmP53cF+lPGO7bGjCo +oNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nni+87ch; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si590256pgj.239.2019.08.14.15.32.44; Wed, 14 Aug 2019 15:33:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nni+87ch; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729617AbfHNWLA (ORCPT + 99 others); Wed, 14 Aug 2019 18:11:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:57956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfHNWLA (ORCPT ); Wed, 14 Aug 2019 18:11:00 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C5BF32064A; Wed, 14 Aug 2019 22:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565820660; bh=2YQMr9WmohFL+xkk50uFprdKReR2E7JTnbbbO1059oA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nni+87chGmQaQDK8GYduslnDr78IJ75iX/jjJzdja8FuHyonKkGVJ9TJbqa+1r2+g Bj5z2EZ9x7Tu4dLBvT9FHLLid9v0DUT5RTzPuYXwyKdKNIbsFi6X0YF5iUvKb5JNAj EqADKsB5cz+e0n1z7exbiuiRittpuRoGaNTXA404= Date: Wed, 14 Aug 2019 15:10:59 -0700 From: Andrew Morton To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Arun KS , Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams Subject: Re: [PATCH v2 4/5] mm/memory_hotplug: Make sure the pfn is aligned to the order when onlining Message-Id: <20190814151059.54618c4f86b7e0c613ab7413@linux-foundation.org> In-Reply-To: <784cba14-e0ad-cfea-8ffc-bfbf855ceb10@redhat.com> References: <20190814154109.3448-1-david@redhat.com> <20190814154109.3448-5-david@redhat.com> <20190814135608.a449ca5a75cd700e077a8d23@linux-foundation.org> <784cba14-e0ad-cfea-8ffc-bfbf855ceb10@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Aug 2019 23:47:24 +0200 David Hildenbrand wrote: > >> --- a/mm/memory_hotplug.c > >> +++ b/mm/memory_hotplug.c > >> @@ -646,6 +646,9 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages, > >> */ > >> for (pfn = start_pfn; pfn < end_pfn; pfn += 1ul << order) { > >> order = min(MAX_ORDER - 1, get_order(PFN_PHYS(end_pfn - pfn))); > >> + /* __free_pages_core() wants pfns to be aligned to the order */ > >> + if (unlikely(!IS_ALIGNED(pfn, 1ul << order))) > >> + order = 0; > >> (*online_page_callback)(pfn_to_page(pfn), order); > >> } > > > > We aren't sure if this occurs, but if it does, we silently handle it. > > > > It seems a reasonable defensive thing to do, but should we add a > > WARN_ON_ONCE() so that we get to find out about it? If we get such a > > report then we can remove the WARN_ON_ONCE() and add an illuminating > > comment. > > > > > > Makes sense, do you want to add the WARN_ON_ONCE() or shall I resend? --- a/mm/memory_hotplug.c~mm-memory_hotplug-make-sure-the-pfn-is-aligned-to-the-order-when-onlining-fix +++ a/mm/memory_hotplug.c @@ -647,7 +647,7 @@ static int online_pages_range(unsigned l for (pfn = start_pfn; pfn < end_pfn; pfn += 1ul << order) { order = min(MAX_ORDER - 1, get_order(PFN_PHYS(end_pfn - pfn))); /* __free_pages_core() wants pfns to be aligned to the order */ - if (unlikely(!IS_ALIGNED(pfn, 1ul << order))) + if (WARN_ON_ONCE(!IS_ALIGNED(pfn, 1ul << order))) order = 0; (*online_page_callback)(pfn_to_page(pfn), order); } _