Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp834947imu; Thu, 22 Nov 2018 06:07:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uf6wK6+qV7/ndqYScCuFR8+A059wRqyMtaYbeSZJFuUIHand0Qiy/ZCwlBJyKV+hkbxpTM X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr11589886plb.26.1542895668158; Thu, 22 Nov 2018 06:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542895668; cv=none; d=google.com; s=arc-20160816; b=tC3ZDMo6K9RKr3uQNY+hkBf3hxgbfs8wFSCr7+qMyXzY7fBWXZBhLg0udaiuogWDQK zBTyvKTWcpdX/ABUIAp1sQIPqXYBArZytE2kh18e9BYSq7vft2UGAziiJBAjecqOSFdb 2TmY6DfqNOs6vSCmDq5JogWPsnxUfJ6GTVi6kUxCcIlTWw8sEVVIiRNK4eIHfUBLYJhK E9L7Hr9KWQIGvNbEOjPr1V6VTFpXrQpK6FnGfNeoWVtK1EFBwUKzFjzjEDWKc3ZtdvQU Q24NzwRZR4FA6eB6SUnZEeFQ+n8accvVCewckG2i+xU7Aus8uzrYvgBA0QokYosoLO9q Mztg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=7zrjiu8Zb3ja6W0Vystz3Pyibc7KL0Wb/36REYwEJwk=; b=vO0akcF9TYK8PffQZyD/lvOMcqMosxcr9HL3ccTK8egB+F2yH7Tb7oGYkZn2is7JIq Lbco8/sUoNIbYhGRS2+0EVGHOmgjBghRZ1ZdxCBzfEoT1XMKF5LGIG+FHv2yKYnfoM93 2nJTPk9w46gK6QIaNUGYwV0tZWjd5/FywgoTzjz7P+l3wXrYdqoXAxy3YfDy2V4xEQUV d8dmqYoWZfUeEtjHtkcgDoMq+JK484SZ7vqfafhSwsgR6gbQyE66CgikKuJ218i485xs Bd11vg+bb9h77xAvxEc7uRfZhqSvTUIktfoiQKQSAOCnZUcnXto0uhZFHvbJ0SiGnLSX Vtow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si49798418pgf.374.2018.11.22.06.07.33; Thu, 22 Nov 2018 06:07:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391934AbeKVNwg (ORCPT + 99 others); Thu, 22 Nov 2018 08:52:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54772 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729224AbeKVNwe (ORCPT ); Thu, 22 Nov 2018 08:52:34 -0500 Received: from localhost.localdomain (c-24-6-170-16.hsd1.ca.comcast.net [24.6.170.16]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 95674721; Thu, 22 Nov 2018 03:15:12 +0000 (UTC) Date: Wed, 21 Nov 2018 19:15:11 -0800 From: Andrew Morton To: Aaron Lu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, =?UTF-8?Q?Pawe=C5=82?= Staszewski , Jesper Dangaard Brouer , Eric Dumazet , Tariq Toukan , Ilias Apalodimas , Yoel Caspersen , Mel Gorman , Saeed Mahameed , Michal Hocko , Vlastimil Babka , Dave Hansen , Alexander Duyck , Ian Kumlien Subject: Re: [PATCH v2 RESEND update 1/2] mm/page_alloc: free order-0 pages through PCP in page_frag_free() Message-Id: <20181121191511.658e0d41504e146edd88af53@linux-foundation.org> In-Reply-To: <20181120014544.GB10657@intel.com> References: <20181119134834.17765-1-aaron.lu@intel.com> <20181119134834.17765-2-aaron.lu@intel.com> <20181120014544.GB10657@intel.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Nov 2018 09:45:44 +0800 Aaron Lu wrote: > page_frag_free() calls __free_pages_ok() to free the page back to > Buddy. This is OK for high order page, but for order-0 pages, it > misses the optimization opportunity of using Per-Cpu-Pages and can > cause zone lock contention when called frequently. > Looks nice to me. Let's tell our readers why we're doing this. --- a/mm/page_alloc.c~mm-page_alloc-free-order-0-pages-through-pcp-in-page_frag_free-fix +++ a/mm/page_alloc.c @@ -4684,7 +4684,7 @@ void page_frag_free(void *addr) if (unlikely(put_page_testzero(page))) { unsigned int order = compound_order(page); - if (order == 0) + if (order == 0) /* Via pcp? */ free_unref_page(page); else __free_pages_ok(page, order); _