Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp584471pxb; Thu, 15 Apr 2021 01:30:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0Mc1l6uKRAAy4K1lPfTP6kO2b7x6+BkO3zQDNL7zeFd0XdI7lhFE1sI2Ce7Kcv/WWPode X-Received: by 2002:a17:90a:f0d5:: with SMTP id fa21mr2630154pjb.59.1618475454544; Thu, 15 Apr 2021 01:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618475454; cv=none; d=google.com; s=arc-20160816; b=rRNx0Vxw4g4770W7D1SsZM1a/COhwW1xBne09nrTmhzw0OFpDRmQUZtgawGQkXfq+Q pVQ+2Cx7mcAtEv62KtIgvXlYSH+k1Ioaf8K+wCT0JUQLP+5HoB7GYgZNSdn526LCMvxK APA1ZBdC691FleLbC0Xql45YzKh+MVgD5ML5TrW89f3UMPSDDjb/jaRLYBOlSs6oB4ug Ju6s1gvlbEoQSUg6Q0uGwqhzp2WnFmhkI2DYAmL2p377SAiWJ4FKI26MbAexXtw8gS4P nD4LdD2OGW+wFJGuOZWu9OC0UlgvYD2u/i5RAd6GUm/dnA5TAhBlzwHgmXJf30l4c/lP hndA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=T/ODPoQoxpzeSxuPnzIGcJ3lecE67Q3JX7ikLGkqFjw=; b=CEq1mpBLiXPCBjGzJ2RN1viL2zBH424mCekO9NclC2dY8Qcq1uGdFOqwsILL2gHS3t KJRTscAJQwDW0H15bOV0y3DAsSsmrib+UTMR5yYiqsO6wBagazL/jjyEl1tlSBFyBOxg Lu/1yby3cWDeOfmZuChurXgXTPOkCA2Nr1pYwAc2Eyl8TiwMX0EyyKfbXEF3smoDqI18 3bJ16ZMt0FscMFzW5RTycsawOOCvCm1mIkzYnUsajJ0dMIn4xuLIXyLMw1zzfERp0XGb sqtFfxBbsBRfsuGHDvk2si5jEC3yb45okQRpHtJxMCvSiWjoalp0pZ5eHAPDDkwz2dJK zjuw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si2482374plp.338.2021.04.15.01.30.42; Thu, 15 Apr 2021 01:30:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231645AbhDOIaA (ORCPT + 99 others); Thu, 15 Apr 2021 04:30:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:38514 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbhDOI37 (ORCPT ); Thu, 15 Apr 2021 04:29:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 06EC4AE72; Thu, 15 Apr 2021 08:29:36 +0000 (UTC) Date: Thu, 15 Apr 2021 10:29:33 +0200 From: Oscar Salvador To: Michal Hocko Cc: Andrew Morton , Mike Kravetz , Vlastimil Babka , David Hildenbrand , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 5/7] mm: Make alloc_contig_range handle free hugetlb pages Message-ID: References: <20210413104747.12177-1-osalvador@suse.de> <20210413104747.12177-6-osalvador@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 03:40:18PM +0200, Michal Hocko wrote: > > + /* > > + * Call __prep_new_huge_page() to construct the hugetlb page, and > > + * enqueue it then to place it in the freelists. After this, > > + * counters are back on track. Free hugepages have a refcount of 0, > > + * so we need to decrease new_page's count as well. > > + */ > > + __prep_new_huge_page(new_page); > > + __prep_account_new_huge_page(h, nid); > > I think it would help to put something like the following into the > comment above this really strange construct. > > /* > * new_page needs to be initialized with the standard > * hugetlb state. This is normally done by > * prep_new_huge_page but that takes hugetlb_lock which > * is already held so we need to open code it here. > * Reference count trick is needed because allocator > * gives us referenced page but the pool requires pages > * with 0 refcount. > */ Ok, I will try to add more info, thanks Michal! -- Oscar Salvador SUSE L3