Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp286877pxb; Fri, 16 Apr 2021 05:49:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWdORXcw1xPQBtyDr2vBHyMNdZlyRHaBEt2yuQSK7hC5q+C1MCDArs7vAuRtfpQjsomX0Y X-Received: by 2002:a17:906:7c82:: with SMTP id w2mr8251053ejo.448.1618577350712; Fri, 16 Apr 2021 05:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618577350; cv=none; d=google.com; s=arc-20160816; b=pkyr9QQUdpUbhzpUC4ukQkClUfljo9kGdV+sqyWz/koywMHsCn7lNu/gRQV2Mx/rNd f1Se0/W4IFa+fWAs9aFJ4SYV09IEPSxfDUfjEDOXxAtZRiLmMh2fcxJnIhZ9kLyR8oH3 onvnmpNxPFXjov+4utl9oxx1R8nqkJCWQ6XKXS/abxor6CW+Ur+BmZQ0FiUa8X4RZV7I vs+CsdfjYB3nPtJ+qdb4fwgV2S9BSod47ZEsL4XwH5OGnZulj996LdHsDwuYxtJjVrg8 VSHyNhjuGDUJuQtYML19PkoarOPnVilWlEhaOrS5K5kLYIZSTl+HJrVDVOaRA3PRkESO ax2A== 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=H5jcKxrhmuEh3peV1tR7bYZVhvsrLPGDrTSRsFyZTc0=; b=gd/GZSCXxQNamqE3TBq9zW19POKfjjoWmQOhCb2nvk6n+UuLpZ3SzFokM5imyaM9Wf Es2pFlSKE2NcUC+U/261xOscrfa20T+QDVe3m8ykgCRyBhuRi3x0ncPwabxXzYZdX3hs Yzj0hlnVFfMAM0WP0GjmyMIN1xeYAXsHyg0dLMRYVWfzwGkumsjGsuFIBbA0+mxngFI8 VRUD3x8iy6lTbVfORG2Kj6zuph8yfaYURCkiWQ7zvAj8SREO9KjrICcnInBD4WbrmsxE 2+d9ZadqH5pj4P6VZYoNqZOSOvGPNPnyf0VufL44TbDboPEH0FNLEVJ1eCoxIRSax38w KATQ== 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 qu7si4711247ejb.282.2021.04.16.05.48.45; Fri, 16 Apr 2021 05:49:10 -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 S241645AbhDPMOg (ORCPT + 99 others); Fri, 16 Apr 2021 08:14:36 -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