From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB08CC43460 for ; Thu, 15 Apr 2021 08:29:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74F6F61166 for ; Thu, 15 Apr 2021 08:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74F6F61166 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 139266B0036; Thu, 15 Apr 2021 04:29:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 111366B006C; Thu, 15 Apr 2021 04:29:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F40A16B0070; Thu, 15 Apr 2021 04:29:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id D93316B0036 for ; Thu, 15 Apr 2021 04:29:37 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8473E180CA185 for ; Thu, 15 Apr 2021 08:29:37 +0000 (UTC) X-FDA: 78033927594.03.4F24050 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf11.hostedemail.com (Postfix) with ESMTP id 53392200025E for ; Thu, 15 Apr 2021 08:29:27 +0000 (UTC) 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: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 53392200025E X-Stat-Signature: 5rf7jxqgy5wm436d4y3z4h38ix3fh9sw Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1618475367-164134 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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