Received: by 10.223.185.116 with SMTP id b49csp1980251wrg; Thu, 15 Feb 2018 04:49:24 -0800 (PST) X-Google-Smtp-Source: AH8x225dE8Jvp17DPR8sQfzznGHjOlXzFRmVDrA8Z7XbB7CRI6yFRS/8B8a/fmjzu+gzGjbeE7nV X-Received: by 10.99.45.195 with SMTP id t186mr2158498pgt.127.1518698964763; Thu, 15 Feb 2018 04:49:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518698964; cv=none; d=google.com; s=arc-20160816; b=szeJOlUO5/9EkUB95nDEKLlzAM8smCSxeR6Kp65m3C198XZOQLzhGkOoqOQTQE+P7n q0L5AhG6EH7U1J6LEpAsSpKiTWO91qGIolJ+5MpafYrF30s2C/m9utCHnnonXj7AVDkE rZiTUG6y4ytttp9hE2n8bRgcXT4fj//KP7zGpi8hL3pUPQgQMDy+Z6HUta0TJZMrxKgG LG2lGHRQ6Gtxwq+pWqORxnLFwKiW9cNptxhpCC3GilCXZ0H4XhBoICFmo/tq7xJJgs5F 2sJpFPK45viisyDkj/pD5G2trDD01OICtJp+VrQxk39zOu9VI8SQFals9d4pjnn59vx2 ee/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=d+lWpbf0QxhqeQGM0cNzQKtqqaCeFcBRH96elf9CQuQ=; b=Vu8ApBVlUfjPdPR9MU95HeGa57CVtSdGMosLssFOxHm0V/9qUPF5OpPj2szXwHWOAl eLCipT8JdzYhvkgkn+CNcT781ulroC8bLRJ4K2/YEsc7H/KTxx1rTJjLVeFxVFWaq5BV NQoqAQT0EkN9INj5/V2LWl5NuEuPblTjVeb9VWw3RdsvosRD3j8ShJaXCheeBWJEPMCx rXAqqFeF6NbMomp+1+akVtnS4rvhA3kBan3XmkSCkp/0Fm1esawX/qW2VSTP1zUv5OTf hpuEdsgOfyHLz1EpWJxxpZLzyhl8M+4YOf3oPQSDosHGF0uhKvNMts/VTKwG7DsTP3nN r7wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qClbRHSY; 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 v2-v6si8721429plo.525.2018.02.15.04.49.09; Thu, 15 Feb 2018 04:49:24 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qClbRHSY; 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 S1031392AbeBOMqv (ORCPT + 99 others); Thu, 15 Feb 2018 07:46:51 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:49132 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030334AbeBOMqt (ORCPT ); Thu, 15 Feb 2018 07:46:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=d+lWpbf0QxhqeQGM0cNzQKtqqaCeFcBRH96elf9CQuQ=; b=qClbRHSYUsboOyG1JkkHr33YO g3Bk1k72bxY+F9A063pdMnkg84d7dWAY04OCEKQKvZFM3IQ+xCacI3uAFjYmpjzL+q0U9vZwIMpSG QI/pKPT9KYGRT/i9pJsZUzc0SsMqPsa0wmGhmQ9rhduUv/jJGHPHsJV7RQg8wDTlQ2ER///09kWmG y2GEni/RNBiGYn/Ndof+lW9CtDITq8vuDv45jUgqreVLYmU0m7nve5D+W0NN0DJbS8phuGMKO79u6 5Bm0DsmBMjy39uzIfZKroV8XoaKcst6cPrh2rbO4p25z5Hqm08fvcaKbe7yboAkWw29Ic59x0kuyP RuyWiInpA==; Received: from willy by bombadil.infradead.org with local (Exim 4.89 #1 (Red Hat Linux)) id 1emIw1-00075I-8W; Thu, 15 Feb 2018 12:46:45 +0000 Date: Thu, 15 Feb 2018 04:46:44 -0800 From: Matthew Wilcox To: Aaron Lu Cc: Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Huang Ying , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , Michal Hocko , Vlastimil Babka Subject: Re: [PATCH v2 1/2] free_pcppages_bulk: do not hold lock when picking pages to free Message-ID: <20180215124644.GA12360@bombadil.infradead.org> References: <20180124023050.20097-1-aaron.lu@intel.com> <20180124163926.c7ptagn655aeiut3@techsingularity.net> <20180125072144.GA27678@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180125072144.GA27678@intel.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 25, 2018 at 03:21:44PM +0800, Aaron Lu wrote: > When freeing a batch of pages from Per-CPU-Pages(PCP) back to buddy, > the zone->lock is held and then pages are chosen from PCP's migratetype > list. While there is actually no need to do this 'choose part' under > lock since it's PCP pages, the only CPU that can touch them is us and > irq is also disabled. I have no objection to this patch. If you're looking for ideas for future improvement though, I wonder whether using a LIST_HEAD is the best way to store these pages temporarily. If you batch them into a pagevec and then free the entire pagevec, the CPU should be a little faster scanning a short array than walking a linked list. It would also puts a hard boundary on how long zone->lock is held, as you'd drop it and go back for another batch after 15 pages. That might be bad, of course. Another minor change I'd like to see is free_pcpages_bulk updating pcp->count itself; all of the callers do it currently.