Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4266488pxf; Tue, 6 Apr 2021 11:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTPr7ohE/cya4971WSBYGutZ65zpBuMvjvyU9zDJQhLa7SJ9XUV/zbXjiIvukh6XPIv7s6 X-Received: by 2002:a02:a809:: with SMTP id f9mr30416721jaj.63.1617735357583; Tue, 06 Apr 2021 11:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617735357; cv=none; d=google.com; s=arc-20160816; b=LXAOpI+oETYP7TDuhs+Cv06oTgWa+U6tNL4Mt4b4Esvx8kA4czYJfM3kAnMmuaAgTb b/briKXJxP+7yD3U7p9OZC0QoB1Laz0AzjhL5j5nAmlE7liwpGgjgUzafRSVaTbCBmZO ktt89kDisfBEqtGYuu81ImeUYnjddjT9l8usIn1g5phNXX8dYEOxzENWiaOEyYua+oWo /Iq0bXAXA26qBSOul7uK4y/PWhp4PcjGX0aG6u+LyZDEHKeApJGH97e7B66MWhxgPw8c pYHbyGntKyasJohrqvVpwp/b5EQNsbaofOKXF6vMXhq2Hi5Ze1TqQYBj78u+62sCTadU H5vA== 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:dkim-signature; bh=656KuN9pjrhu4sCZqILrkK+S2NOZRWLCsVXRfCBqK70=; b=QEXunOeNAhSj+PDMLJNI4CFTwi2rabjZgXczAddnrjI/ongYNHUd+9o0vZWhNKFtbJ t8Z03usd8Tuj6IODJOIOvX6ybhyHXj/F5DywO2m/hGlrUZsbzkXvUX8m052EXK7NGpe+ jdbfao/bI5CYwW/14wvhK+zO1YVnI+wK8DoXJnzdImk8/KKnnC4YNlw1JMZvNMQuG7KG LGv+gidAg+wPZuOl0/4R/0IIqVNQ2067DPyXLj7iQvRbJjjGo64Ao/WefxCCXU64gjZB lPBkA2iLIuKJ/tk7Z/1JwV7wq3hRyHBBsY7uP34NATmP/peToBf0T7vV91DA3OMXJd9s IhhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=pV5WDB56; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si19171277jak.28.2021.04.06.11.55.45; Tue, 06 Apr 2021 11:55:57 -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.com header.s=susede1 header.b=pV5WDB56; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233720AbhDFJ4X (ORCPT + 99 others); Tue, 6 Apr 2021 05:56:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:56976 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233527AbhDFJ4V (ORCPT ); Tue, 6 Apr 2021 05:56:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617702973; 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=656KuN9pjrhu4sCZqILrkK+S2NOZRWLCsVXRfCBqK70=; b=pV5WDB56i74o7vVmZdBJd8BuNa3HoBvkalqJOjTkBoFnGpVXqkNklgKin3mrj+C13lsptW vC4yPZ9or06QspUCvee4QAsrhrLFHTx7tXNxeLjsEgim30RN91GJ4jVlHimwFwYjio6aLg L5K+yNmU6JumYn7l4Mbqy9fyeAOnCCM= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C8B8DB137; Tue, 6 Apr 2021 09:56:12 +0000 (UTC) Date: Tue, 6 Apr 2021 11:56:11 +0200 From: Michal Hocko To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin , Shakeel Butt , Oscar Salvador , David Hildenbrand , Muchun Song , David Rientjes , Miaohe Lin , Peter Zijlstra , Matthew Wilcox , HORIGUCHI NAOYA , "Aneesh Kumar K . V" , Waiman Long , Peter Xu , Mina Almasry , Hillf Danton , Joonsoo Kim , Barry Song , Will Deacon , Andrew Morton Subject: Re: [PATCH v4 4/8] hugetlb: create remove_hugetlb_page() to separate functionality Message-ID: References: <20210405230043.182734-1-mike.kravetz@oracle.com> <20210405230043.182734-5-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210405230043.182734-5-mike.kravetz@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 05-04-21 16:00:39, Mike Kravetz wrote: > The new remove_hugetlb_page() routine is designed to remove a hugetlb > page from hugetlbfs processing. It will remove the page from the active > or free list, update global counters and set the compound page > destructor to NULL so that PageHuge() will return false for the 'page'. > After this call, the 'page' can be treated as a normal compound page or > a collection of base size pages. > > update_and_free_page no longer decrements h->nr_huge_pages{_node} as > this is performed in remove_hugetlb_page. The only functionality > performed by update_and_free_page is to free the base pages to the lower > level allocators. > > update_and_free_page is typically called after remove_hugetlb_page. > > remove_hugetlb_page is to be called with the hugetlb_lock held. > > Creating this routine and separating functionality is in preparation for > restructuring code to reduce lock hold times. This commit should not > introduce any changes to functionality. > > Signed-off-by: Mike Kravetz Btw. I would prefer to reverse the ordering of this and Oscar's patchset. This one is a bug fix which might be interesting for stable backports while Oscar's work can be looked as a general functionality improvement. > @@ -2298,6 +2312,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, > /* > * Freed from under us. Drop new_page too. > */ > + remove_hugetlb_page(h, new_page, false); > update_and_free_page(h, new_page); > goto unlock; > } else if (page_count(old_page)) { > @@ -2305,6 +2320,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, > * Someone has grabbed the page, try to isolate it here. > * Fail with -EBUSY if not possible. > */ > + remove_hugetlb_page(h, new_page, false); > update_and_free_page(h, new_page); > spin_unlock(&hugetlb_lock); > if (!isolate_huge_page(old_page, list)) the page is not enqued anywhere here so remove_hugetlb_page would blow when linked list debugging is enabled. -- Michal Hocko SUSE Labs