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 A918BC433E0 for ; Sun, 28 Feb 2021 13:43:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0F1464D73 for ; Sun, 28 Feb 2021 13:43:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0F1464D73 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 6F2EF8D0021; Sun, 28 Feb 2021 08:43:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A2228D0019; Sun, 28 Feb 2021 08:43:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B8198D0021; Sun, 28 Feb 2021 08:43:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 4385D8D0019 for ; Sun, 28 Feb 2021 08:43:45 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EF2AD7582 for ; Sun, 28 Feb 2021 13:43:44 +0000 (UTC) X-FDA: 77867794368.16.57011A8 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf26.hostedemail.com (Postfix) with ESMTP id 23828407F8DF for ; Sun, 28 Feb 2021 13:43:39 +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 0EC38AB7D; Sun, 28 Feb 2021 13:43:43 +0000 (UTC) Date: Sun, 28 Feb 2021 14:43:40 +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: <20210228134340.GA3292@localhost.localdomain> 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: X-Stat-Signature: uhaufwaa1y3fkhbqiozewwsspc4x3xew X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 23828407F8DF Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1614519819-348720 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 01:46:21PM +0100, Michal Hocko wrote: > Well, I will leave it to others. I do not feel strongly about this but > to me it makes the code harder to think about because the situation is > unstable and any of those condition can change as they are evaluated. So > an explicit checks makes the code harder in the end. I would simply got > with > if (isolate_huge_page(head, list) || !alloc_and_dissolve_huge_page()) > ret = true; > > if either of the conditional needs a retry then it should be done > internally. Like alloc_and_dissolve_huge_page already does to stabilize > the PageFreed flag. An early bail out on non-free hugetlb page would > also better be done inside alloc_and_dissolve_huge_page. The retry could be done internally in alloc_and_dissolve_huge_page in case someoen grabbed the page from under us, but calling isolate_huge_page from there seemed a bit odd to me, that is why I placed the logic in the outter function. It looks more logic to me, but of course, that is just my taste. I do not think it makes the code that hard to follow, but I will leave it to the others. If there is a consensus that a simplistic version is prefered, I do not have a problem to go with that. Mike, what is your take on this? Thanks -- Oscar Salvador SUSE L3