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 B90BEC433ED for ; Fri, 16 Apr 2021 12:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96ECD611AF for ; Fri, 16 Apr 2021 12:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241753AbhDPMOh (ORCPT ); Fri, 16 Apr 2021 08:14:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:37450 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbhDPMOf (ORCPT ); Fri, 16 Apr 2021 08:14:35 -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 5EEB0B035; Fri, 16 Apr 2021 12:14:10 +0000 (UTC) Date: Fri, 16 Apr 2021 14:14:04 +0200 From: Oscar Salvador To: Baoquan He Cc: Andrew Morton , Mike Kravetz , Vlastimil Babka , David Hildenbrand , Michal Hocko , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michal Hocko Subject: Re: [PATCH v9 5/7] mm: Make alloc_contig_range handle free hugetlb pages Message-ID: References: <20210416070023.4742-1-osalvador@suse.de> <20210416070023.4742-6-osalvador@suse.de> <20210416094920.GA8560@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210416094920.GA8560@MiWiFi-R3L-srv> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 05:49:20PM +0800, Baoquan He wrote: > On 04/16/21 at 09:00am, Oscar Salvador wrote: > ... > > +/* > > + * alloc_and_dissolve_huge_page - Allocate a new page and dissolve the old one > > + * @h: struct hstate old page belongs to > > + * @old_page: Old page to dissolve > > + * Returns 0 on success, otherwise negated error. > > + */ > > +static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page) > > +{ > > + gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; > > + int nid = page_to_nid(old_page); > > + struct page *new_page; > > + int ret = 0; > > + > > + /* > > + * Before dissolving the page, we need to allocate a new one for the > > + * pool to remain stable. Using alloc_buddy_huge_page() allows us to > > + * not having to deal with prep_new_page() and avoids dealing of any > ~ prep_new_huge_page() ? Yep, clumsy. @Andrew: could you please amend that or should I send a new version? Thanks -- Oscar Salvador SUSE L3