Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1152552ybl; Wed, 14 Aug 2019 11:34:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvTlcFTwjxVG1pre0DOX947nxeTiwoNO3GjOGO67+b1lqAqLC5b+wSeJwsWsB4pNA9fQmn X-Received: by 2002:aa7:85d6:: with SMTP id z22mr1302419pfn.262.1565807691761; Wed, 14 Aug 2019 11:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565807691; cv=none; d=google.com; s=arc-20160816; b=g0j9AmczTHrtTQ9+kVrjp1bhJ1Gvxo29YsrUHjz8nEv3Hu2rqFNTWEwQsuw4A/29Wn XNRveBuDKy2PNDaxoXVoCwcFNYWBHVPZQOHVrylY07DuglimruNc8Mj5KXf7E9A2+OqI 8tm/rLTcg0m7Vb1keLbMY23+tIea1HXM6NqEkjL3bKi1WTb5A3rdaSB7AYzHCNuRM3g8 q7YxPfVtJ7XkwjEYCM50m1ZaUTr1clRbe9GWUu7b5RpliwHyAwlhhYgXvB29IoBHp2hz CQyQ/IuCE/72cB4L0RtI7yV9WV5Ujsq+4/P2x2mclRh7GcA19aqo9A7pohsgx3lMBw1P QmTw== 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:message-id:subject:cc :to:from:date; bh=+nf14xhh1xo1hNIYLQkWv9VymCQEGmByy8FeajFIgoI=; b=ZZDglwX4SdY9wJcfzqMhkKv0SDL1kv9mtj2NaMoanzwps/iesgGf8DTYqGylkUpCHI 0i70CFvjengLUKg1oL1+NqpQQ6njXmtA6p/rySU8jfy7IPSu8i4vLfzfCRWPakkyAcob hwDACWcWdGlDoSx1DUpnKNNjZfMa6zt+2tIEi18ERh0sAShCY74zKhllvCx1OjiN4Bm0 ublYlyv/7JO56UpykGKIb/mVt/4NFloYyASCDpcmO5Vk+pl2iFA+YgVw+cOTJj3lnSaH 6Aqxl+JcL1wCO9gkcISrkuEVcYiUJH2kBga2zwjkEQwQXRUdOCN5g6HvaMsXxN0pdlPc dlgg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si274470pjf.60.2019.08.14.11.34.35; Wed, 14 Aug 2019 11:34:51 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728556AbfHNSci (ORCPT + 99 others); Wed, 14 Aug 2019 14:32:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:50678 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726522AbfHNSci (ORCPT ); Wed, 14 Aug 2019 14:32:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 512CEAF5B; Wed, 14 Aug 2019 18:32:37 +0000 (UTC) Date: Wed, 14 Aug 2019 20:32:35 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Arun KS , Andrew Morton , Oscar Salvador , 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: <20190814183235.GJ17933@dhcp22.suse.cz> References: <20190814154109.3448-1-david@redhat.com> <20190814154109.3448-5-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 14-08-19 18:09:16, David Hildenbrand wrote: > On 14.08.19 17:41, David Hildenbrand wrote: > > Commit a9cd410a3d29 ("mm/page_alloc.c: memory hotplug: free pages as higher > > order") assumed that any PFN we get via memory resources is aligned to > > to MAX_ORDER - 1, I am not convinced that is always true. Let's play safe, > > check the alignment and fallback to single pages. > > > > Cc: Arun KS > > Cc: Andrew Morton > > Cc: Oscar Salvador > > Cc: Michal Hocko > > Cc: Pavel Tatashin > > Cc: Dan Williams > > Signed-off-by: David Hildenbrand > > --- > > mm/memory_hotplug.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > > index 63b1775f7cf8..f245fb50ba7f 100644 > > --- 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); > > } > > > > > > @Michal, if you insist, we can drop this patch. "break first and fix > later" is not part of my DNA :) I do not insist but have already expressed that I am not a fan of this change. Also I think that "break first" is quite an over statement here. -- Michal Hocko SUSE Labs