Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3034420ybc; Mon, 18 Nov 2019 08:30:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxt4XdrZd6VnaW2COwqckkJ+K66A6NV+ZIlL9XwDyGeCLNxW7L2ypiNSK27aa70H8royN7G X-Received: by 2002:a5d:678f:: with SMTP id v15mr29793973wru.242.1574094642538; Mon, 18 Nov 2019 08:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574094642; cv=none; d=google.com; s=arc-20160816; b=vRZ9sFOCUUk6g2A4f/E89e1dSl7lhZc4byxS4zLpjJt0qSWH9Rjmn2ei23jdts0MGa 1x8XbUrQLrYLOi6MDqjool6H3rOiZSfhjS1ZGAGFIoPZzH80ChIuh8sVp/0VHBwpKfe5 +p4mE6GnfliuNyyfNGzDF37dYfLKpjXUWfTh/AOUOqu0P/GEAtdjnHKy731CoF2rRz66 CrkBgEzUTkUQJ9Y2KFKhkQAXQZDqqxqrCSMhKU3zoBJbicweAhQsa0hor3zrKh8ePN7i mYdgB2/jeEE2lC9zEdWfC7E6oQQ2C2eQDmwL6UYaMZ/eUUbaYX5f+mdmF6oLVixlx+7S wRzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=HmHvIepJ44AMH/uol92+eD8HI10UpbvWvyNRekfZtL8=; b=aRoTetB2uvm/igAvCWn43toiiwea6+WbwS6TZsT/VbC/swaFlWxAF+Zchvxm2O95v3 F0ZKCE4TNLbHqUy9TkUlbvrT/kzvmSOmmhYi4G0CGDvykf5n//A6kNfLfBKVtn0vXlvk QVLIBnjEqV7qX0QSOORGML6kzf0csc1OBZ2LlyURI2CSykhCXlwjSPiz+HcsenZ8fCfk qGNN031XnS8a10OGkyxWuE10BsPX+lOzIgAbOVAVq7lDw3R+A2TtszKyQjCOi5nIAnd7 KhNTXnFGe95fj5p5ZmNShQlG28c2I/iDIGZ4kg1aVN1/74aGnadVOEjZgQfIDoqSSH1I a25A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c29si14215352edb.223.2019.11.18.08.30.17; Mon, 18 Nov 2019 08:30:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726714AbfKRQ0r (ORCPT + 99 others); Mon, 18 Nov 2019 11:26:47 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:28640 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726216AbfKRQ0q (ORCPT ); Mon, 18 Nov 2019 11:26:46 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAIGCW80096060 for ; Mon, 18 Nov 2019 11:26:44 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2way67fqp3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 11:26:43 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Nov 2019 16:26:42 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Nov 2019 16:26:37 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAIGQaH854001892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Nov 2019 16:26:36 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55DFD4203F; Mon, 18 Nov 2019 16:26:36 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5A2442049; Mon, 18 Nov 2019 16:26:33 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av24.portsmouth.uk.ibm.com (Postfix) with SMTP; Mon, 18 Nov 2019 16:26:33 +0000 (GMT) Date: Mon, 18 Nov 2019 21:56:33 +0530 From: Srikar Dronamraju To: Dave Chinner Cc: Ming Lei , 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 , Jens Axboe , Ingo Molnar , Peter Zijlstra , Tejun Heo Subject: Re: single aio thread is migrated crazily by scheduler Reply-To: Srikar Dronamraju References: <20191114113153.GB4213@ming.t460p> <20191114235415.GL4614@dread.disaster.area> <20191115010824.GC4847@ming.t460p> <20191115045634.GN4614@dread.disaster.area> <20191115070843.GA24246@ming.t460p> <20191115234005.GO4614@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20191115234005.GO4614@dread.disaster.area> User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 x-cbid: 19111816-0020-0000-0000-0000038982B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111816-0021-0000-0000-000021DFAA93 Message-Id: <20191118162633.GC32306@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_04:2019-11-15,2019-11-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dave Chinner [2019-11-16 10:40:05]: > On Fri, Nov 15, 2019 at 03:08:43PM +0800, Ming Lei wrote: > > On Fri, Nov 15, 2019 at 03:56:34PM +1100, Dave Chinner wrote: > > > On Fri, Nov 15, 2019 at 09:08:24AM +0800, Ming Lei wrote: > > I can reproduce the issue with 4k block size on another RH system, and > > the login info of that system has been shared to you in RH BZ. > > > > 1) > > Almost all the fio task migrations are coming from migration/X > kernel threads. i.e it's the scheduler active balancing that is > causing the fio thread to bounce around. > Can we try with the below patch. -- Thanks and Regards Srikar Dronamraju --->8-----------------------------8<---------------------------------- From 9687c1447532558aa564bd2e471b7987d6bda70f Mon Sep 17 00:00:00 2001 From: Srikar Dronamraju Date: Tue, 2 Jul 2019 16:38:29 -0500 Subject: [PATCH] sched/fair: Avoid active balance on small load imbalance Skip active load balance when destination CPU is busy and the imbalance is small and fix_small_imabalance is unable to calculate minor imbalance. Its observed that active load balances can lead to ping-pong of tasks between two CPUs. Signed-off-by: Srikar Dronamraju --- kernel/sched/fair.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3599bdcab395..0db380c8eb6c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7094,6 +7094,7 @@ enum group_type { #define LBF_SOME_PINNED 0x08 #define LBF_NOHZ_STATS 0x10 #define LBF_NOHZ_AGAIN 0x20 +#define LBF_SMALL_IMBL 0x40 struct lb_env { struct sched_domain *sd; @@ -8386,6 +8387,8 @@ void fix_small_imbalance(struct lb_env *env, struct sd_lb_stats *sds) /* Move if we gain throughput */ if (capa_move > capa_now) env->imbalance = busiest->load_per_task; + else if (env->idle == CPU_NOT_IDLE) + env->flags |= LBF_SMALL_IMBL; } /** @@ -8466,7 +8469,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s * moved */ if (env->imbalance < busiest->load_per_task) - return fix_small_imbalance(env, sds); + fix_small_imbalance(env, sds); } /******* find_busiest_group() helpers end here *********************/ @@ -8732,6 +8735,13 @@ static int need_active_balance(struct lb_env *env) if (voluntary_active_balance(env)) return 1; + /* + * Destination CPU is not idle and fix_small_imbalance is unable + * to calculate even minor imbalances, skip active balance. + */ + if (env->flags & LBF_SMALL_IMBL) + return 0; + return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2); } -- 2.18.1