Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp325561ybi; Thu, 11 Jul 2019 20:12:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf6fGatIdM5/2KA85kxXO9wIVHdppuofVv/BzAiuDKcXUhH2+4dF5HrgY1JsLT9Klv6UCA X-Received: by 2002:a17:902:ab8f:: with SMTP id f15mr8449664plr.159.1562901178416; Thu, 11 Jul 2019 20:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562901178; cv=none; d=google.com; s=arc-20160816; b=SFp2sQ6v+LZhHQe60Htp2kVVc3boCFpSVD12HB98nsQj56/cGkySHfGym31sHGXeaF iO098bVmpkpjNLDYpZqsfzFaNcKYYKwSwC8DQfiBQKlJbZ/kufdjod4AzK+5M/h48W7M /vcdc8CZLNM9dW7mNJdoaQYzSSr4QP0t5jJBtUJaraALP+fyFLupWtgVas/HmyrA15vU 8MMlIyeFlvIKOiREUDO5f6tYTaK7+N97A4YkqBLbZ7FQ58hAXwlkaym0Mi9q4tB5atEo 2iPgEdP5/FB55jYonielR3RQKL/D3cbrn8fVDMUn/QQGSCguQl0eeuPs03ih9bY0a6g3 O7Hg== 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=8yIBI6EFnDFXxbPYKj916DCtzCtMurdycLFwzVm1XTU=; b=qHmBKO7ddMT1sRZi0AsEjCSNx3U/U5bL9/zrFAr/BbFvBMJHJrhKXDjA8wKdaZNu4/ jnRkDoldNZ8rNENzxZ+Lfxmv+zNCxHT4jSAbh2MdHjukQmGD3m2gDG907/x/JfWrbDOQ iivCBpg23T4PHJrwdKrMUH5dgMmI1uhtE7iYK1a7pdZM9pcQsuP4IYm/OYBca741KhJ9 xum8HuKjCnIPWLSUoWaZbnae9OIfxv+xl0Pc2Ppe8fBNzcDYUBpO1U7mnMDMUfox+Uht ooBz4j1r7TowFKs2cj+V1udav+kYId4DHpQx5O86MB3tSQZBx3hdTLVDkeQYXYjvOfac k/9g== 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 61si6372836ple.275.2019.07.11.20.12.42; Thu, 11 Jul 2019 20:12:58 -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 S1729281AbfGLDKP (ORCPT + 99 others); Thu, 11 Jul 2019 23:10:15 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:45891 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729239AbfGLDKO (ORCPT ); Thu, 11 Jul 2019 23:10:14 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0TWfcINf_1562901008; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0TWfcINf_1562901008) by smtp.aliyun-inc.com(127.0.0.1); Fri, 12 Jul 2019 11:10:09 +0800 Subject: Re: [PATCH 4/4] numa: introduce numa cling feature To: Peter Zijlstra Cc: 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, Mel Gorman , riel@surriel.com References: <209d247e-c1b2-3235-2722-dd7c1f896483@linux.alibaba.com> <60b59306-5e36-e587-9145-e90657daec41@linux.alibaba.com> <9a440936-1e5d-d3bb-c795-ef6f9839a021@linux.alibaba.com> <20190711142728.GF3402@hirez.programming.kicks-ass.net> From: =?UTF-8?B?546L6LSH?= Message-ID: <82f42063-ce51-dd34-ba95-5b32ee733de7@linux.alibaba.com> Date: Fri, 12 Jul 2019 11:10:08 +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: <20190711142728.GF3402@hirez.programming.kicks-ass.net> 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/11 下午10:27, Peter Zijlstra wrote: [snip] >> Thus we introduce the numa cling, which try to prevent tasks leaving >> the preferred node on wakeup fast path. > > >> @@ -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; >> + >> return target; >> } > > Select idle sibling should never cross node boundaries and is thus the > entirely wrong place to fix anything. Hmm.. in our early testing the printk show both select_task_rq_fair() and task_numa_find_cpu() will call select_idle_sibling with prev and target on different node, thus we pick this point to save few lines. But if the semantics of select_idle_sibling() is to return cpu on the same node of target, what about move the logical after select_idle_sibling() for the two callers? Regards, Michael Wang >