Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp237082imu; Wed, 19 Dec 2018 17:30:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VeEcvNgY3K2qLs6XupeIw8z9Cb36bRQ0WwIxxQ7NA0P6XzuY7gMAO1CXPnaPb4YQRStD6z X-Received: by 2002:a63:f201:: with SMTP id v1mr19920925pgh.232.1545269438380; Wed, 19 Dec 2018 17:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545269438; cv=none; d=google.com; s=arc-20160816; b=PFBsIrdOSZ1M3ZBuJ5j6yda8kJeO5pxLFaMq+mhCBpWe/aew6XuPvHLMJAh1vhICot SXjVNJwD2Rb4+ZjLqNhkYJLgimBk3Z77Z9uilRwfH/H7NibT1qUp3MeZHhSMmiKY4wCU XX8euqwxGrzUt1mCwEXz5ffGLD2RzdM9p4L/b2zMW48yeavqyBvHMgudw6uJXr0JTKTo Lm1n/c8MSCWZvmL0/qnlnuHO5iQJQYOfXJ+0ikxo79WXCURE1ciFiO6nnMka5iBKgWfM J26FZFeIzX3Y6q59UpLDXWdHFkdXo94OsM2G0+wUTj4FiIYzA736QHrMNA0LHQJqSbjh MSAQ== 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=LQ6ZBaT6d7ZNEfmjwTtowKWd8jKmq3ufdqhsbx7iFNE=; b=Pklh8IejZ+r3x4/+isHLNSTNAe2WvNxqpcMjBvBRfwDiP7D75wFB9k468OTMDl4SZy mLFEI7H2OfDol71ZTkJH0E3UQv4FlhwMoa5glwUZEqcB+1JWGJFhRL8fHg3hH7hciOcG vqZxF+GTIajoxCcs+mO18yhBexhC1cWg/Yx39ugJuOF96H2OV8r+CMmgaeP3o2oL/jE1 Z7XiPiiG0Br78oVgWcpvTzwA0Lo03s+XsGROdIQQiOJMFB7xjrnNcqGj5byu8ao5Hp8K TuiljVL2eI4brtKCy6iRAMnPm8XwwL8e3+YSWIVNzxMVCs+KVFFF6ChkQGhWKdm64bpY BhuQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si17085949pgb.107.2018.12.19.17.30.21; Wed, 19 Dec 2018 17:30:38 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729427AbeLSXjV (ORCPT + 99 others); Wed, 19 Dec 2018 18:39:21 -0500 Received: from charybdis-ext.suse.de ([195.135.221.2]:51527 "EHLO suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726535AbeLSXjV (ORCPT ); Wed, 19 Dec 2018 18:39:21 -0500 Received: by suse.de (Postfix, from userid 1000) id 746393C94; Thu, 20 Dec 2018 00:39:19 +0100 (CET) Date: Thu, 20 Dec 2018 00:39:18 +0100 From: Oscar Salvador To: Wei Yang Cc: akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, pavel.tatashin@microsoft.com, rppt@linux.vnet.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm, page_alloc: Fix has_unmovable_pages for HugePages Message-ID: <20181219233914.2fxe26pih26ifvmt@d104.suse.de> References: <20181217225113.17864-1-osalvador@suse.de> <20181219142528.yx6ravdyzcqp5wtd@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181219142528.yx6ravdyzcqp5wtd@master> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 19, 2018 at 02:25:28PM +0000, Wei Yang wrote: > >- iter = round_up(iter + 1, 1< >+ skip_pages = (1 << compound_order(head)) - (page - head); > >+ iter = round_up(iter + 1, skip_pages) - 1; > > The comment of round_up says round up to next specified power of 2. And > second parameter must be a power of 2. > > Look skip_pages not satisfy this. I thought that gigantic pages were always allocated on 1GB aligned. At least alloc_gigantic_page() looks for 1GB range, aligned to that. But I see that in alloc_contig_range(), the boundaries can differ. Anyway, unless I am missing something, I think that we could just get rid of the round_up() and do something like: <-- skip_pages = (1 << compound_order(head)) - (page - head); iter = skip_pages - 1; --> which looks more simple IMHO. It should just work for 2MB and 1GB Hugepages. -- Oscar Salvador SUSE L3