Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2838751pxk; Mon, 28 Sep 2020 01:01:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOesPRE2T1sB3QSDUDE38ETsTAz74InseDp4SwIqHqAl83ATCmcvX6btplesy90ZkAlImw X-Received: by 2002:a05:6402:1779:: with SMTP id da25mr359945edb.75.1601280108617; Mon, 28 Sep 2020 01:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601280108; cv=none; d=google.com; s=arc-20160816; b=YdNi70tNbFfYcSfGuVFy68rGbmqgNS04JwRqwaH1N0ZEAdnUF+8AGy8Ru0Zt+6il7B cP9EUWS255tZEBSjjRd2kCgJY1a5taUjf7R/PssO/tNRi+RLzFCMqJFBcc8dvUP83ZH4 CfbNfLuK3t3HM1RU/GcgBmgo2Vk7tklDT8xR0nBew1ohcYqEKNpMhtl+ikXwdefLuF87 xE6FuebsoQ64n7a+UtTw4CaasTrrl7JZL5pkxDCT0JC6+JzaYbnrcySqP1Y6VlJ8ASM9 J0PBb0ZatQskHWGLl6gvFqqn6SJRt0EYta6+db72J9HgaHlnzHyO3mzxbBBcv9pCKDgB vtQg== 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; bh=H7c4FqNYiiP3D8BWik1LFDP71wy6CQ2bbzojK8L2cas=; b=j65l8P0r6aJOyu3FgeKNcKDhwBkyezAInGMxtGcUw877UoUF0ql/xDK10Y+EGuFnb3 IAdEFuOO4kxxaGinXyL5ZyPDAVJByDtefYOyngvUZL8JcyjMPwG5uLKynIh1uv4Unhn5 cKyKkSfVF0QSk8dLHvICQJBbQDENJyb/fwOeJ79tKMWglKmnOYIs+0ULzsIkN8aReHre QXSSbHmTIWITRpXbLUWWtDE4Nnvz7+F1AIU3C+72joscMiorc8loJASRElbZobi/kRKR ZI9b9Me6FWG7nLYmN5gAzW/QiXUcWwnZ237RzCb3plamTgC3BCiODsj/hRgxDbegmBEa mfQA== 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 ga5si136184ejb.547.2020.09.28.01.01.25; Mon, 28 Sep 2020 01:01:48 -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; 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 S1726751AbgI1H63 (ORCPT + 99 others); Mon, 28 Sep 2020 03:58:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:47686 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbgI1H63 (ORCPT ); Mon, 28 Sep 2020 03:58:29 -0400 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 DBD45B038; Mon, 28 Sep 2020 07:58:27 +0000 (UTC) Date: Mon, 28 Sep 2020 09:58:24 +0200 From: Oscar Salvador To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, Andrew Morton , Alexander Duyck , Mel Gorman , Michal Hocko , Dave Hansen , Vlastimil Babka , Wei Yang , Mike Rapoport , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu Subject: Re: [PATCH RFC 4/4] mm/page_alloc: place pages to tail in __free_pages_core() Message-ID: <20200928075820.GA4082@linux> References: <20200916183411.64756-1-david@redhat.com> <20200916183411.64756-5-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916183411.64756-5-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 08:34:11PM +0200, David Hildenbrand wrote: > @@ -1523,7 +1524,13 @@ void __free_pages_core(struct page *page, unsigned int order) > > atomic_long_add(nr_pages, &page_zone(page)->managed_pages); > set_page_refcounted(page); > - __free_pages(page, order); > + > + /* > + * Bypass PCP and place fresh pages right to the tail, primarily > + * relevant for memory onlining. > + */ > + page_ref_dec(page); > + __free_pages_ok(page, order, FOP_TO_TAIL); Sorry, I must be missing something obvious here, but I am a bit confused here. I get the part of placing them at the tail so rmqueue_bulk() won't find them, but I do not get why we decrement page's refcount. IIUC, its refcount will be 0, but why do we want to do that? Another thing a bit unrelated... we mess three times with page's refcount (two before this patch). Why do we have this dance in place? Thanks -- Oscar Salvador SUSE L3