Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2485356pxb; Thu, 11 Feb 2021 13:41:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxV3CTblRJDnrPVvMoM7YJ1wKRmLKWYRw7WyJSaT7bAUisfDJytGa2tlxwqMcgFu9YfW6WD X-Received: by 2002:a17:906:2495:: with SMTP id e21mr10414658ejb.280.1613079662967; Thu, 11 Feb 2021 13:41:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613079662; cv=none; d=google.com; s=arc-20160816; b=tgXmlHe8hUayamYQWOuPi+dSFwJBW6U09vwC1OEb7pODzEA+6Es/UdBKOeeTSwgfLv 5fRLwzvlZbQU17g1wgrmn9J1u1QsNfHCRwEKP01uPM9vRuST7A+fn0mkMvGr3/oo4J6Q fZVobRYvnMJXtlOvTW0K3fO81pf5JxawW9HxgjqG2pAaSayGTffSQAI33rAXwfabwSPB eaEhVKxuQVs+i+b/rNPOMOCriMaU3JsP/rdND9G4gvm5bx1QouuShwpTDfoSwMWF2IKb OOgthX+hyVBPzjysxwtRs5j9frBNH20waqae7j1KsKz5QitBLhaDXJgwSFqMhhvLU/bH 7a/Q== 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=yxrJVx+fGdqpKHqYz+zxSBliD4pI7EBwAqQb14Xg8mA=; b=t5zG4PirI7prXprjuayYNdaYRe5fzBGYOVqtME0JQVnyvk8mIce7ttuN5+c/1kDur2 D7eVD0VhzHcGXDAj0n3xtHeg0OqFn5ypMpuFn8FrExCHWnZNi55Yfzj3qb7Kpo9w/ltS smQgGv1ihKyRjKkKRdgakJ/I0aqVZKzyvQ/7UoZ1m5AHWbgtTfnnzD+1Zpxce50bVx8h gECkhytZN4vM+5veFXTF52+bHopizvaKnC1b0uWKfUW0haQn/LNploikN95ZiJtoviyy 8jW/4PpkZCUF9kN3mG9XDS1lQwH+BstYt+N3EuB+asBGlIiidUUcj5K0SqcNQAiOPylp tmdQ== 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 g24si4725351edu.329.2021.02.11.13.40.39; Thu, 11 Feb 2021 13:41:02 -0800 (PST) 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 S229868AbhBKVjU (ORCPT + 99 others); Thu, 11 Feb 2021 16:39:20 -0500 Received: from mx2.suse.de ([195.135.220.15]:47368 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhBKVjL (ORCPT ); Thu, 11 Feb 2021 16:39:11 -0500 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 6577CAE91; Thu, 11 Feb 2021 21:38:26 +0000 (UTC) Date: Thu, 11 Feb 2021 22:38:23 +0100 From: Oscar Salvador To: Mike Kravetz Cc: David Hildenbrand , Muchun Song , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/2] mm,page_alloc: Make alloc_contig_range handle free hugetlb pages Message-ID: <20210211213823.GB3597@localhost.localdomain> References: <20210208103812.32056-1-osalvador@suse.de> <20210208103812.32056-3-osalvador@suse.de> <5a6c0efb-4667-c382-8c3e-fd95b6ae839e@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a6c0efb-4667-c382-8c3e-fd95b6ae839e@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 05:16:29PM -0800, Mike Kravetz wrote: > Should probably check for -EBUSY as this means someone started using > the page while we were allocating a new one. It would complicate the > code to try and do the 'right thing'. Right thing might be getting > dissolving the new pool page and then trying to isolate this in use > page. Of course things could change again while you are doing that. :( Yeah, I kept the error handling rather low just be clear about the approach I was leaning towards, but yes, we should definitely check for -EBUSY on dissolve_free_huge_page(). And it might be that dissolve_free_huge_page() returns -EBUSY on the old page, and we need to dissolve the freshly allocated one as it is not going to be used, and that might fail as well due to reserves for instance, or maybe someone started using it? I have to confess that I need to check the reservation code closer to be aware of corner cases. We used to try to be clever in such situations in memory-failure code, but at some point you end up thinking "ok, how many retries are considered enough?". That code was trickier as we were handling uncorrected/corrected memory errors, so we strived to do our best, but here we can be more flexible as the whole thing is racy per se, and just fail if we find too many obstacles. I shall resume work early next week. Thanks for the tips ;-) -- Oscar Salvador SUSE L3