From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751541AbdAWUER (ORCPT ); Mon, 23 Jan 2017 15:04:17 -0500 Received: from outbound-smtp08.blacknight.com ([46.22.139.13]:57183 "EHLO outbound-smtp08.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbdAWUEP (ORCPT ); Mon, 23 Jan 2017 15:04:15 -0500 Date: Mon, 23 Jan 2017 20:04:12 +0000 From: Mel Gorman To: Tejun Heo Cc: Vlastimil Babka , Andrew Morton , Linux Kernel , Linux-MM , Hillf Danton , Jesper Dangaard Brouer , Petr Mladek Subject: Re: [PATCH 3/4] mm, page_alloc: Drain per-cpu pages from workqueue context Message-ID: <20170123200412.mkesardc4mckk6df@techsingularity.net> References: <20170117092954.15413-1-mgorman@techsingularity.net> <20170117092954.15413-4-mgorman@techsingularity.net> <06c39883-eff5-1412-a148-b063aa7bcc5f@suse.cz> <20170120152606.w3hb53m2w6thzsqq@techsingularity.net> <20170123170329.GA7820@htj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20170123170329.GA7820@htj.duckdns.org> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 23, 2017 at 12:03:29PM -0500, Tejun Heo wrote: > Hello, > > On Fri, Jan 20, 2017 at 03:26:06PM +0000, Mel Gorman wrote: > > > This translates to queue_work_on(), which has the comment of "We queue > > > the work to a specific CPU, the caller must ensure it can't go away.", > > > so is this safe? lru_add_drain_all() uses get_online_cpus() around this. > > > > > > > get_online_cpus() would be required. > > This part of workqueue usage has always been a bit clunky and I should > imrpove it but you don't necessarily have to pin the cpus from > queueing to execution. You can queue without checking whether the CPU > is online and instead synchronize the actual work item execution > against cpu offline callback so that if the work item gets executed > after offline callback is finished, it becomes a noop. > What is the actual mechanism that does that? It's not something that schedule_on_each_cpu does and one would expect that the core workqueue implementation would get this sort of detail correct. Or is this a proposal on how it should be done? -- Mel Gorman SUSE Labs