Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2369921pxb; Thu, 28 Oct 2021 23:17:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFBgtX69gK/4PDXGEp6J9878+yKqBVx9mqVt3AANq5ngVT/q8bwjbm5ez89wOwDO2t3ftx X-Received: by 2002:a50:e08a:: with SMTP id f10mr12761816edl.319.1635488225351; Thu, 28 Oct 2021 23:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635488225; cv=none; d=google.com; s=arc-20160816; b=B6VMVVSzZTzr8kcKUYa0RaeLeux7vO0fxY5PH+r5WM5qSmYxxiLdM60KT15SvjPTb6 AQb8sB/T7Tw5ybcZLTMqAAwoi1SmDeNGRLfMIYohSQwC+vRdz1Aa6P6URBOQ/kL4XcPA DEpgs+OKJbgGesNZHcnZPtHVEpzHlwN6d0JzJA8pehnRL/zpRQ5z+LGvfQUyRKV+juM1 8NgzenvHSMNsORQLggh1Sub3fEGKt6+bbVbbFETrYUIVufR38AofV2j6uhE0Z0w8oTlP lgf67MyvemzF0pCR+HuGyUfDtP3Z8Qe/NOpqdnTgrln/fzwInT95XFP4O20bfqjaReEK CM+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GmBAManK6+5n92cYCAjM0Y2324rUvA8onYfURui5swg=; b=zosl9bS1kc4EGTZWyuMawW73GIQX99h/LNgjOvzlFFYpbgalotgrt3Zps8fFp7cKAK rInQ0bF4RkWh5hzTNfIccCw6VBez14uDcm2AwChamSvKiCegQBMdo195T9GiNJjOhU2S Lk7aWvvqUj+ZSaEONxIWGv6johKjkcC1Y8s2IzeADQ0kkSNHp83kbPy4OHiWiRDCUbXi 7K9QgRtWhwcars1JOczJDYKlv9TgdpjmtfqM6vSgGn1d6nOqslBqhir7fZzbvhX2LQ+t GURfvIJryec1u94t0PP1kJSkEHuFO++BqpGNQIHr6CSayVdsvkvsL458psabs/8tPSRq RubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FzRfo54v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cs11si9361629ejc.468.2021.10.28.23.16.28; Thu, 28 Oct 2021 23:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=FzRfo54v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbhJ2GPG (ORCPT + 99 others); Fri, 29 Oct 2021 02:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbhJ2GPE (ORCPT ); Fri, 29 Oct 2021 02:15:04 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70CA3C061745 for ; Thu, 28 Oct 2021 23:12:36 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id r5so6174354pls.1 for ; Thu, 28 Oct 2021 23:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=GmBAManK6+5n92cYCAjM0Y2324rUvA8onYfURui5swg=; b=FzRfo54vrj1x+VLw9hZRhsWcpjKLGH17K667QXoIO36SpX9iUX4FFkZJEEPXUpJGsV EtmWWVbnaZKVDy8mKtra/0rlwBqNkvmRWqC00/6xN4ZoC9Fmg2VPISK13AgHJGdZEVLD dp2KqjrXbrOmMPeP1SXzkQSSIjmjMtjiIQmXJ9O/tSdqZKGjRhMplffWWzbbkfLc1aDZ MdoBLJKytMXXpcG2Q10pe40fSIxz/RXnZZXA6zESGj3MoScrAUky4Qbt7DDQoV+wZYEG pBdAf8H4oQ2xhC2jqtcYR9YAfqfZeYZQEhwgn0plZ7GRCU3BPi2QryAOfRpj9Nwrnyi2 TthA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GmBAManK6+5n92cYCAjM0Y2324rUvA8onYfURui5swg=; b=2hChqg7RSjKm99/WNucHfm4gjh2sMmzm6DY7JMRuRIPxzjJhdifMOLvd+DU0C9c24X zhMRuQxCiJo8CQmPhalMz8ClFzuIn2sjmg0HL8Hq/Nvgym4ZNZHAxg472OYtqBpwMTmJ gwmihQJeLSt5RPT/1dgZWGRM53IOmqD7RFUVpEQ4LvIAbgVy7bfdJRbgGgfNxtvLhblo 3rWDarjMsgfUtlzek3lF4fFHtE4LzqvoeUQN4P5IGW5ah3yDfQ7dVx5qrarOcHackpjg Xiv6Oa7OQhjJTonNBsJgjIvhye0zYq/IIA1jRcDIoVEDtjOL5RFO3KUdNTsbwJ/DZllt ap1w== X-Gm-Message-State: AOAM530KOjRXCA+ikuT1rZl8hTv9hLnnbhPLTcKpuHJp8Z98ZYbi0C3t pFmnFep6qBQenOdqGtNHapmZxQ== X-Received: by 2002:a17:902:f546:b0:141:b70e:1dd with SMTP id h6-20020a170902f54600b00141b70e01ddmr181519plf.30.1635487955947; Thu, 28 Oct 2021 23:12:35 -0700 (PDT) Received: from [10.76.43.192] ([61.120.150.76]) by smtp.gmail.com with ESMTPSA id h6sm4796507pfi.174.2021.10.28.23.12.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Oct 2021 23:12:35 -0700 (PDT) Subject: Re: Re: [PATCH v1] sched/numa: add per-process numa_balancing To: Mel Gorman Cc: Jonathan Corbet , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org References: <20211027132633.86653-1-ligang.bdlg@bytedance.com> <20211028153028.GP3891@suse.de> From: Gang Li Message-ID: Date: Fri, 29 Oct 2021 14:12:28 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211028153028.GP3891@suse.de> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/21 11:30 PM, Mel Gorman wrote: > > That aside though, the configuration space could be better. It's possible > to selectively disable NUMA balance but not selectively enable because > prctl is disabled if global NUMA balancing is disabled. That could be > somewhat achieved by having a default value for mm->numa_balancing based on > whether the global numa balancing is disabled via command line or sysctl > and enabling the static branch if prctl is used with an informational > message. This is not the only potential solution but as it stands, > there are odd semantic corner cases. For example, explicit enabling > of NUMA balancing by prctl gets silently revoked if numa balancing is > disabled via sysctl and prctl(PR_NUMA_BALANCING, PR_SET_NUMA_BALANCING, > 1) means nothing. > static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) { ... if (static_branch_unlikely(&sched_numa_balancing)) task_tick_numa(rq, curr); ... } static void task_tick_numa(struct rq *rq, struct task_struct *curr) { ... if (!READ_ONCE(curr->mm->numa_balancing)) return; ... } When global numa_balancing is disabled, mm->numa_balancing is useless. So I think prctl(PR_NUMA_BALANCING, PR_SET_NUMA_BALANCING,0/1) should return error instead of modify mm->numa_balancing. Is it reasonable that prctl(PR_NUMA_BALANCING,PR_SET_NUMA_BALANCING,0/1) can still change the value of mm->numa_balancing when global numa_balancing is disabled?