Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp562295imu; Thu, 20 Dec 2018 01:23:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wh2+9EMbI7LzVzkDxTHgRKSq9lGwfivpjULwP9HzpRsyGfGrqaVVDSibf5LnJKwt5AB+CC X-Received: by 2002:a17:902:76cb:: with SMTP id j11mr24018751plt.179.1545297835235; Thu, 20 Dec 2018 01:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545297835; cv=none; d=google.com; s=arc-20160816; b=AY56zYuiJvby8oYG7CTWEjIxiYJ+zgTQBTsb9gPPVegSpUzki83VINI9rXfFnKKuiN KQBvBBVST+4vuiQjRLqkpSjsXu473cXVAcBjjtBTZV4cJz9PdWEzNo2+j96E+H5zffaV c0P9ZdLOZNuZXRvqPZ4S4cBmy6cj/DuUR4EWxHF7l7FERvDXcZTa3VYSOYM+NCA3HbR+ I+BjORRz0W5qPcZqHcU6H6p24M2pWh3sOCaJiv6o0CVcH3CJqtboJUrCHx4sT1YUEYqP ZmAYkkNJTi6zmG5ZaXONsbax1biUOlBbTs7GS1e4NXkiQolsOU1nhNr3CV9aGrXVoUGA BO3w== 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=UYOV9neix9nIg1tM5hLIQ09t/XxRpJfIRKi9NG5IBKE=; b=iCigeqQH3LXD1VGK4vMkPdJsL06mP9kA5at0EZM2bx9pXcL2VRuuDOHU+Cbh9qBCw/ xEc1wbF+mq8K9VqRGM+RZoVZARM0hdjpao6wzR9Z3iC1jb2uVz2PsDL3rm8gOS0lK6Ss lfhxQ+9yr7cEOkyWomPvP1mwiuOJ2G3x7FYR/JSBc0ccL2g3V328RY0P9qcs1sg1sWOp x6WffK7rP7df3qu33b9eC210rW9Yeve/qRffS6HyCIupcT77rWWn+0m/M3YddxfZqPiy b+SUAhh0kSCj/XSCpkrix/d7+WGq4QXEYv+xHV/OZq234IcfGfZgMFI7cC8waZ7t+avg qY4A== 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 y191si17171813pgd.4.2018.12.20.01.23.39; Thu, 20 Dec 2018 01:23:55 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730170AbeLTJMa (ORCPT + 99 others); Thu, 20 Dec 2018 04:12:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:51058 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728172AbeLTJMa (ORCPT ); Thu, 20 Dec 2018 04:12:30 -0500 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 86D8EB044; Thu, 20 Dec 2018 09:12:28 +0000 (UTC) Date: Thu, 20 Dec 2018 10:12:28 +0100 From: Michal Hocko To: Oscar Salvador Cc: Wei Yang , akpm@linux-foundation.org, 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: <20181220091228.GB14234@dhcp22.suse.cz> References: <20181217225113.17864-1-osalvador@suse.de> <20181219142528.yx6ravdyzcqp5wtd@master> <20181219233914.2fxe26pih26ifvmt@d104.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181219233914.2fxe26pih26ifvmt@d104.suse.de> 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 Thu 20-12-18 00:39:18, Oscar Salvador wrote: > 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. Yes this is true but the resulting numbers should be correct even for skips that are not power of 2 AFAIC. Or do you have any counter example? > > 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. Agreed! -- Michal Hocko SUSE Labs