Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3439447ybc; Thu, 21 Nov 2019 08:21:13 -0800 (PST) X-Google-Smtp-Source: APXvYqytBBW5a+d0lGZUzVFXky+HGXwyLKg01ZM551vh1roZlNuehX7jE+Gm/ZDvCDH5TPj4bu4p X-Received: by 2002:a05:6512:28f:: with SMTP id j15mr8291083lfp.129.1574353273567; Thu, 21 Nov 2019 08:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574353273; cv=none; d=google.com; s=arc-20160816; b=JAFq6JQ3De+L1/Kb0ecL6BEgjkJj6sj1geBmr3qvSsMqg0OHbcXzCqi7LFVV9EfdhT hRtE0rjC19jLTMyyiR222nrhhtUtAtrsm2erX5gcW8/pZ3lT8sRDb8TU+W9dvcOFCCqK zi2lZ2olT+pZE4OjKW+Yv/I2ARGxh2g13doysxDUM7yEcK7X44C6JQkDH5xScrP/Y2+M DH+c5E9TCGS4zhBZ7HApqcqTKUfGyVT0lGWJG5oRx1PovcWbp67m1J9H68yZtcm5nGAu wtU8TiJdhLuKIesI5EUXtX1/yiasS16Pa+qcaQHr16dITiNWvfJWu7sgubcPap+AuVhb dmIA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Kvj1OGlYWXQ7ytbrKDsR/TZrdswK2tP2241AuGz5/5c=; b=cVjj0TMWsK5wN1mk3ttJXUA+QDBXMMQijkKz//7FZshuXIWlnMrla89v5eoIlt2I70 B5p3RbJRMpudB+yOW6WIeJMIeWdGz6kcvjqN/drzB+85EPrSvFO6p85hLfj+0NUv5+9T NmPD3bqbUL2+Ye4UsYx+IgMTpUb8zndLoqzc+mUsafZBsSulphBOre2PhVJj3F6SZEc7 JSb2z7gZNLXLND0WhOmHuyO0o5EDSM92rc48PRG2kxft+WTFgxaimgxD4WV/RhgGbhft jAeLCUffincBgTkb66th5DtLklXovxknIHSSvkVNYVTqtQ4Vn1xCHjpR8IA4U4zf5GXx j7FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=13PRjt8K; 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 m33si2443867edc.126.2019.11.21.08.20.47; Thu, 21 Nov 2019 08:21:13 -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=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=13PRjt8K; 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 S1726912AbfKUQTd (ORCPT + 99 others); Thu, 21 Nov 2019 11:19:33 -0500 Received: from mail-il1-f196.google.com ([209.85.166.196]:33519 "EHLO mail-il1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbfKUQTd (ORCPT ); Thu, 21 Nov 2019 11:19:33 -0500 Received: by mail-il1-f196.google.com with SMTP id m5so3866206ilq.0 for ; Thu, 21 Nov 2019 08:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Kvj1OGlYWXQ7ytbrKDsR/TZrdswK2tP2241AuGz5/5c=; b=13PRjt8K4a2KOy8p0LkwxnTJWoXSCik2jil6eEf+nKpRFAw/WneYao35gDdiKIYb8a /xbKq7CVsVyzhDgT+qYN/CXr3mCN2tfs+V0MqYVdrCI2Jb32I4Ml32hjse8GLaNlaycf hYaBMSvPkL+QfF3Lvq/i3o6MjQtTDBiQupjgl92he/XUE3u4BgZxrZD9tAbZinpSEUYU 2lSCSv9xThV5eLe3YZDmcM97/cNnOWZV98EnnXiUAMBXRqNCvJZBU5vH+6PmZW8aIykE 9DEJv2ax5uyrJda8ehDfb4X3GDoJCPgbX91gZGQy8X+YmKVFC3yiYvNgQw+HOQ+Sveg+ m5CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Kvj1OGlYWXQ7ytbrKDsR/TZrdswK2tP2241AuGz5/5c=; b=WspHcE93fUrqRB9q3zlghqzeRmZy2RkeznfM/VR2MxUHYEMye8S5+vmNH3WMIoNCtW tqxDbBOy83DGaoOwTfUUw79MAlshs+10973foussZU7Jy6JH/JC0TeAzD6yhRDYqv/pG IxtS9GUo2bKyDjFtMHyIZVlms5BB9ijjOl80zecnRdK4fJCI/ncUj8O0S36QqOup9yCZ PDhIo02qrNQDdDnFcUMDy6lbAcJj3CD8UU5qT4/Kn/peVoFEDdPY9F/k6xE6oB8Nd3TG wlSB3mwOCoGPCnTIbrFTaHLvA2xtjDD6KieriIhifvDspJ0qIU2sNLkLoMLdHnTPveZT j5DQ== X-Gm-Message-State: APjAAAXnZxhy58Q5M/NsZCGHPbY8N44rGbYlNl8FWlRQes1x2eLqkJ00 uDXUU0jPO8jVsldN0JduGgU1fw== X-Received: by 2002:a05:6e02:8e7:: with SMTP id n7mr10886315ilt.302.1574353172148; Thu, 21 Nov 2019 08:19:32 -0800 (PST) Received: from [192.168.1.159] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id b21sm1392809ilg.88.2019.11.21.08.19.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Nov 2019 08:19:31 -0800 (PST) Subject: Re: single aio thread is migrated crazily by scheduler To: Boaz Harrosh , Phil Auld , Ming Lei Cc: Peter Zijlstra , Dave Chinner , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Moyer , Dave Chinner , Eric Sandeen , Christoph Hellwig , Ingo Molnar , Tejun Heo , Vincent Guittot References: <20191114235415.GL4614@dread.disaster.area> <20191115010824.GC4847@ming.t460p> <20191115045634.GN4614@dread.disaster.area> <20191115070843.GA24246@ming.t460p> <20191115234005.GO4614@dread.disaster.area> <20191118092121.GV4131@hirez.programming.kicks-ass.net> <20191118204054.GV4614@dread.disaster.area> <20191120191636.GI4097@hirez.programming.kicks-ass.net> <20191120220313.GC18056@pauld.bos.csb> <20191121041218.GK24548@ming.t460p> <20191121141207.GA18443@pauld.bos.csb> <93de0f75-3664-c71e-9947-5b37ae935ddc@plexistor.com> From: Jens Axboe Message-ID: <8c02ab43-3880-68db-f293-9958510fb29e@kernel.dk> Date: Thu, 21 Nov 2019 09:19:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <93de0f75-3664-c71e-9947-5b37ae935ddc@plexistor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/19 8:02 AM, Boaz Harrosh wrote: > On 21/11/2019 16:12, Phil Auld wrote: > <> >> >> The scheduler doesn't know if the queued_work submitter is going to go to sleep. >> That's why I was singling out AIO. My understanding of it is that you submit the IO >> and then keep going. So in that case it might be better to pick a node-local nearby >> cpu instead. But this is a user of work queue issue not a scheduler issue. >> > > We have a very similar long standing problem in our system (zufs), that we had to do > hacks to fix. > > We have seen these CPU bouncing exacly as above in fio and more > benchmarks, Our final analysis was: > > One thread is in wait_event() if the wake_up() is on the same CPU as > the waiter, on some systems usually real HW and not VMs, would bounce > to a different CPU. Now our system has an array of worker-threads > bound to each CPU. an incoming thread chooses a corresponding cpu > worker-thread, let it run, waiting for a reply, then when the > worker-thread is done it will do a wake_up(). Usually its fine and the > wait_event() stays on the same CPU. But on some systems it will wakeup > in a different CPU. > > Now this is a great pity because in our case and the work_queue case > and high % of places the thread calling wake_up() will then > immediately go to sleep on something. (Work done lets wait for new > work) > > I wish there was a flag to wake_up() or to the event object that says > to relinquish the remaning of the time-slice to the waiter on same > CPU, since I will be soon sleeping. Isn't that basically what wake_up_sync() is? -- Jens Axboe