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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 AC346C433E0 for ; Fri, 26 Feb 2021 10:27:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F13E864EC4 for ; Fri, 26 Feb 2021 10:27:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F13E864EC4 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 5FDF66B0005; Fri, 26 Feb 2021 05:27:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5878C6B0006; Fri, 26 Feb 2021 05:27:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49C5A6B006C; Fri, 26 Feb 2021 05:27:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 30EF86B0005 for ; Fri, 26 Feb 2021 05:27:42 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E3852A8C3 for ; Fri, 26 Feb 2021 10:27:41 +0000 (UTC) X-FDA: 77860042722.08.B9C2EA0 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf20.hostedemail.com (Postfix) with ESMTP id 8AAA512E for ; Fri, 26 Feb 2021 10:27:41 +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 7FE9CACF6; Fri, 26 Feb 2021 10:27:40 +0000 (UTC) Date: Fri, 26 Feb 2021 11:27:38 +0100 From: Oscar Salvador To: Michal Hocko Cc: Andrew Morton , Mike Kravetz , David Hildenbrand , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] mm: Make alloc_contig_range handle in-use hugetlb pages Message-ID: <20210226102738.GB3557@linux> References: <20210222135137.25717-1-osalvador@suse.de> <20210222135137.25717-3-osalvador@suse.de> <20210226102424.GA3557@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210226102424.GA3557@linux> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8AAA512E X-Stat-Signature: h4twry5j49xu1rmcb1h3f8m3kbtw7gnj Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1614335261-993839 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 Fri, Feb 26, 2021 at 11:24:29AM +0100, Oscar Salvador wrote: > On Fri, Feb 26, 2021 at 09:46:57AM +0100, Michal Hocko wrote: > > On Mon 22-02-21 14:51:37, Oscar Salvador wrote: > > [...] > > > @@ -2394,9 +2397,19 @@ bool isolate_or_dissolve_huge_page(struct page *page) > > > */ > > > if (hstate_is_gigantic(h)) > > > return ret; > > > - > > > - if (!page_count(head) && alloc_and_dissolve_huge_page(h, head)) > > > +retry: > > > + if (page_count(head) && isolate_huge_page(head, list)) { > > > ret = true; > > > + } else if (!page_count(head)) { > > > > This is rather head spinning. Do we need to test page_count in the else > > branch? Do you want to optimize for a case where the page cannot be > > isolated because of page_huge_active? > > Well, I wanted to explictly call out both cases. > We either 1) have an in-use page and we try to issolate it or 2) we have a free > page (count == 0). > > If the page could not be dissolved due to page_huge_active, this would either > mean that page is about to be freed, or that someone has already issolated the > page. > Being the former case, one could say that falling-through alloc_and_dissolve is > ok. > > But no, I did not really want to optimize anything here, just wanted to be explicit > about what we are checking and why. Maybe I could add a comment to make it more explicit. -- Oscar Salvador SUSE L3