Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7314238ybi; Mon, 8 Jul 2019 19:16:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxufJVArHJfA9+kDpNoe2gjpYQ3Q9gsHoH42AsF0QOU4mrs+ATeAwwdd8mCSnh0LbDNvzub X-Received: by 2002:a65:4844:: with SMTP id i4mr27879392pgs.113.1562638600646; Mon, 08 Jul 2019 19:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562638600; cv=none; d=google.com; s=arc-20160816; b=J//iavJB5OZfz3wN6E2SLKbA6U3rj4fajyauGCQrvjHzsE+T6wpbFmZJYFRg+2OLYt 8b516pfo9eE5OLgQsOTwarbhWQmrOlaxrLbPiSEOYcEH87FN6f7OPCd/YnmLUW6LpMZY ainKENoyQf/VSbks5YykcFRUQeRy6rlyicdPCkOvhkdp60Ujbf4+L4hFl8qSUAoFSTHN zHzLRucVDSmnp0tMUCjUng7+Aqmjwmw2C9MPD8ddmKlqHnwWmYkIYr0eOvOS/JbDqzd/ NCru9s9opZh9FLFQeaDsF9Bjdzfwmbn4R1uppC/de6JRm7tUZ2A4XbSZgUFLQR07HTr2 D23A== 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; bh=CPjPfndIjOKQc3IzFmTwxHTH1Ut6b5kh6IBkOCVktI8=; b=EXPDyF5WlY7kTpKYaoiFgFcfbZxX129kvatVT5ltMBz+40e34cZCyb7fdEZQNxm3pd 2vVkBaC6u4SmykWxD/Yr7Dlx53Wj1DCAHGlXJY/10tm3pMlZQAiZXF+dlaeSj51uvZcY NWZY8S6ik23ddm2e/iZIGy+Vkkje22DsnVaMrlBCp7SArOh3NVkTh3VmEbSD7eXUP8KD EqX+nQ//NBehFqNOSAcdwYVY/1PqA6LHCfoV2jeyBP0rdurvfmTpdYo1JHFUhtRp07Ep KSmgQD4l9+6EiKpM/1//EplbqhofnQrdBZYTPEmZlVnmwnUxxVfxjgt8aGjkcJSboSUS yNGw== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m39si19799602plg.155.2019.07.08.19.16.25; Mon, 08 Jul 2019 19:16:40 -0700 (PDT) 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727015AbfGICPq (ORCPT + 99 others); Mon, 8 Jul 2019 22:15:46 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:41499 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbfGICPq (ORCPT ); Mon, 8 Jul 2019 22:15:46 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R291e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0TWQeV8w_1562638537; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0TWQeV8w_1562638537) by smtp.aliyun-inc.com(127.0.0.1); Tue, 09 Jul 2019 10:15:38 +0800 Subject: Re: [PATCH v2 4/4] numa: introduce numa cling feature To: Hillf Danton Cc: Peter Zijlstra , hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, mcgrof@kernel.org, keescook@chromium.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org References: <209d247e-c1b2-3235-2722-dd7c1f896483@linux.alibaba.com> From: =?UTF-8?B?546L6LSH?= Message-ID: Date: Tue, 9 Jul 2019 10:15:37 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/7/8 下午4:07, Hillf Danton wrote: > > On Mon, 8 Jul 2019 10:25:27 +0800 Michael Wang wrote: >> /* Attempt to migrate a task to a CPU on the preferred node. */ >> static void numa_migrate_preferred(struct task_struct *p) >> { >> + bool failed, target; >> unsigned long interval = HZ; >> >> /* This task has no NUMA fault statistics yet */ >> @@ -1891,8 +2117,12 @@ static void numa_migrate_preferred(struct task_struct *p) >> if (task_node(p) == p->numa_preferred_nid) >> return; >> >> + target = p->numa_preferred_nid; >> + > Something instead of bool can be used, too. Thx for point out :-) to be fix in v3. > >> /* Otherwise, try migrate to a CPU on the preferred node */ >> - task_numa_migrate(p); >> + failed = (task_numa_migrate(p) != 0); >> + >> + update_migrate_stat(p, target, failed); >> } >> >> static void >> @@ -6195,6 +6447,13 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) >> if ((unsigned)i < nr_cpumask_bits) >> return i; >> >> + /* >> + * Failed to find an idle cpu, wake affine may want to pull but >> + * try stay on prev-cpu when the task cling to it. >> + */ >> + if (task_numa_cling(p, cpu_to_node(prev), cpu_to_node(target))) >> + return prev; >> + > Curious to know what test figures would look like without the above line. It depends on the wake affine condition then, when waker task consider wakee suitable for pull, wakee may leave the preferred node, or maybe pull to the preferred node, just randomly and follow the fate. In mysql case when there are many such wakeup cases and system is very busy, the observed workloads could be 4:6 or 3:7 distributed in two nodes. Regards, Michael Wang > >> return target; >> } >> >> Tested on a 2 node box with 96 cpus, do sysbench-mysql-oltp_read_write >> testing, X mysqld instances created and attached to X cgroups, X sysbench >> instances then created and attached to corresponding cgroup to test the >> mysql with oltp_read_write script for 20 minutes, average eps show: >> >> origin ng + cling >> 4 instances each 24 threads 7545.28 7790.49 +3.25% >> 4 instances each 48 threads 9359.36 9832.30 +5.05% >> 4 instances each 72 threads 9602.88 10196.95 +6.19% >> >> 8 instances each 24 threads 4478.82 4508.82 +0.67% >> 8 instances each 48 threads 5514.90 5689.93 +3.17% >> 8 instances each 72 threads 5582.19 5741.33 +2.85% >