Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4289651pxb; Mon, 25 Oct 2021 01:03:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9X9ximbYR5eOWzCZrytoyG2wJPEEHz6qoqFhz6ZCVXZyImelO2LLv8YM/T4mHYf5mVwHh X-Received: by 2002:a17:907:3f8c:: with SMTP id hr12mr20601681ejc.77.1635148996964; Mon, 25 Oct 2021 01:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635148996; cv=none; d=google.com; s=arc-20160816; b=jsInzsShchqRDWhZWwGarcSJo5n6ZlwhK5+IrWsRnD+k6wipTmXYYjRMoXfXQ+WAMW nbePZmdrWII6eCpj+uglR8iQcRFhHakwroFnZ7tFGE5aCAfgrjBocS5+XAxdkthAE+3q iPVlSvUsYFp7qrO/IR4qkJxRSRaoJOrPbXGDhuT9M7mb2t9Q7yqos98xtOC1rZ00v8iz MqzKMN2AdmK8q/uulj9HDLqTlwm3pTPUskUq5p1gJdW+BdD6imW4K9a/YumM4rgwOIQP c2QkG67+9yicor7LbtjcmZCcE9m4IALL2W7Lgsj5EXbJIaLWkot7XhdxlZ1x7a5c6QU1 jb0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=mKRH8EdFpKe+IkGGQ8FHlcAmk/te4+2Ta56sNX7LB5A=; b=qTSiy1jfn8/nZKm2gUqBHvIYYRVvhfBKCKq5mPQHpmu4SvUn6bt6By7+z8Qp0W5bRo KW2TOgyeL0qmxkokrodEfHTLEuzF+SriDXLZkEfM+NpQ/BqANnIbSC4R8lAmT/SatcRi Yb8D+m4/e3jBAa0g8vZkcuThrLsP6jLR8SaAUL9Cin7KQ+eIXlmGB07ctjDSBVWnxrrM nvVcNaEKosAg1PUvXjcDmZkYLPswt0Y3jFJmyvzCOUNKeuOZDqF228eySygAQilkQqhM hMgNUvdaTAM01sRQbJHSk1pi6JydNLJKA93I1gtZuA6zBnZNd5wMMMMIMnKH5+XJcd1i NitQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="g/E70dhR"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tC73mkyw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s5si1855179ejn.407.2021.10.25.01.02.54; Mon, 25 Oct 2021 01:03:16 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="g/E70dhR"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=tC73mkyw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbhJYH0O (ORCPT + 99 others); Mon, 25 Oct 2021 03:26:14 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:52728 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbhJYH0M (ORCPT ); Mon, 25 Oct 2021 03:26:12 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AE1FB21709; Mon, 25 Oct 2021 07:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1635146629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mKRH8EdFpKe+IkGGQ8FHlcAmk/te4+2Ta56sNX7LB5A=; b=g/E70dhR8XFSUmzMohoFP6uxLBiw6v5yPqYRdCxcuCQgmuphYdnWG/qtMjWaoo1+iSkC7J gz1vA/pOdTXsFS6xOv4nVlOFo1zLIVHiIUp1aLPL8/Vq2s5MtKEvkx0DdAxoX3pt37fegi ckV1cpnuLVlvB/M7O1KlOwd39xnxKbk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1635146629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mKRH8EdFpKe+IkGGQ8FHlcAmk/te4+2Ta56sNX7LB5A=; b=tC73mkywFtzUeABGS6vGp+X1G4mTwtpsuspQQu8hsw02FMD9BsX+ArZ6vmQWnw2RVJptpo 1A3C3xH1ZdBcmmDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1035A1342A; Mon, 25 Oct 2021 07:23:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ftY5AYVbdmFECAAAMHmgww (envelope-from ); Mon, 25 Oct 2021 07:23:49 +0000 Date: Mon, 25 Oct 2021 09:23:47 +0200 From: Oscar Salvador To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Michal Hocko , Zi Yan , Muchun Song , Naoya Horiguchi , David Rientjes , "Aneesh Kumar K . V" , Nghia Le , Andrew Morton Subject: Re: [PATCH v4 4/5] hugetlb: add demote bool to gigantic page routines Message-ID: <20211025072347.GA6338@linux> References: <20211007181918.136982-1-mike.kravetz@oracle.com> <20211007181918.136982-5-mike.kravetz@oracle.com> <20211018075851.GB11960@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 12:05:47PM -0700, Mike Kravetz wrote: > How about if this commit message provides links to previous commits > describing these issues? There are pretty extensive descriptions in > those previous commits, so no need to repeat here IMO. Fine by me. > The patch with an updated commit message is below. > > From 10fcff70c809402901a93ea507d5506c87a8227d Mon Sep 17 00:00:00 2001 > From: Mike Kravetz > Date: Fri, 22 Oct 2021 11:50:31 -0700 > Subject: [PATCH v4 4/5] hugetlb: add demote bool to gigantic page routines > > The routines remove_hugetlb_page and destroy_compound_gigantic_page > will remove a gigantic page and make the set of base pages ready to be > returned to a lower level allocator. In the process of doing this, they > make all base pages reference counted. > > The routine prep_compound_gigantic_page creates a gigantic page from a > set of base pages. It assumes that all these base pages are reference > counted. > > During demotion, a gigantic page will be split into huge pages of a > smaller size. This logically involves use of the routines, > remove_hugetlb_page, and destroy_compound_gigantic_page followed by > prep_compound*_page for each smaller huge page. > > When pages are reference counted (ref count >= 0), additional > speculative ref counts could be taken as described in previous > commits [1] and [2]. This could result in errors while demoting > a huge page. Quite a bit of code would need to be created to > handle all possible issues. > > Instead of dealing with the possibility of speculative ref counts, avoid > the possibility by keeping ref counts at zero during the demote process. > Add a boolean 'demote' to the routines remove_hugetlb_page, > destroy_compound_gigantic_page and prep_compound_gigantic_page. If the > boolean is set, the remove and destroy routines will not reference count > pages and the prep routine will not expect reference counted pages. > > '*_for_demote' wrappers of the routines will be added in a subsequent > patch where this functionality is used. > > [1] https://lore.kernel.org/linux-mm/20210622021423.154662-3-mike.kravetz@oracle.com/ > [2] https://lore.kernel.org/linux-mm/20210809184832.18342-3-mike.kravetz@oracle.com/ > Signed-off-by: Mike Kravetz Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE Labs