From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C8FC38A2D for ; Thu, 27 Oct 2022 07:39:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B95C8E0002; Thu, 27 Oct 2022 03:39:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 868C68E0001; Thu, 27 Oct 2022 03:39:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 758058E0002; Thu, 27 Oct 2022 03:39:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 67A668E0001 for ; Thu, 27 Oct 2022 03:39:51 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 338A68106E for ; Thu, 27 Oct 2022 07:39:51 +0000 (UTC) X-FDA: 80065930182.07.7BA0CA3 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf13.hostedemail.com (Postfix) with ESMTP id B01B720002 for ; Thu, 27 Oct 2022 07:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666856389; x=1698392389; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=jweFWZMSXgqQ6tBTe/QKSoQxmkPbv29fClDdATqJ80E=; b=SPKndOqFYjx/fOhqhlbyrlPnI1YVxyEWxrzWrlMtypRqsf/2saW7zVgX LSw2c+QOS8boT31UksWBmUIRsXxc+bRmJqC7ETODO0NVDCVBVgwQO7npP CepR9NG9aRz2nit4iEioorkYmJ3gCebmoefwAwVrV91IlaPq6yCCs3BvT /T0b63apb+9jKJE6qcgTpUpqCIzbI9oUBr+NiOCVijd1I4NFt+DK82U8c mxTjiHk6BhS/DBu+w+WHnhFMT9dWbm05/AvhAOSNFRIHxtVi2Sr52C86H mNt4E0Jr8b/jqOExyCyBzOlIyimNdjZ0jgvhJng4l3tOcVYmYK3OR0NeO w==; X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="372367555" X-IronPort-AV: E=Sophos;i="5.95,217,1661842800"; d="scan'208";a="372367555" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 00:39:48 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="737573783" X-IronPort-AV: E=Sophos;i="5.95,217,1661842800"; d="scan'208";a="737573783" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 00:39:44 -0700 From: "Huang, Ying" To: Michal Hocko Cc: Feng Tang , Aneesh Kumar K V , Andrew Morton , Johannes Weiner , Tejun Heo , Zefan Li , Waiman Long , "linux-mm@kvack.org" , "cgroups@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Hansen, Dave" , "Chen, Tim C" , "Yin, Fengwei" Subject: Re: [PATCH] mm/vmscan: respect cpuset policy during page demotion References: <20221026074343.6517-1-feng.tang@intel.com> <87wn8lkbk5.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Thu, 27 Oct 2022 15:39:00 +0800 In-Reply-To: (Michal Hocko's message of "Thu, 27 Oct 2022 09:10:28 +0200") Message-ID: <87o7txk963.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666856390; a=rsa-sha256; cv=none; b=chhAcAGda07+PHDz5aoQB+18A0jLLG4pPkbdrU6f4v3aVyb8fAh9ZWYaxWenquZOTPz4m1 FtVsbORY0MlPqs4tRGzd5KKGPZRdJ4DqQ4Gs1S8K5n13xO8szvo5D/kkdLTwnBj03phLjR JnTtkfsRnum+TwW433VlMbHuMBsfckQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=SPKndOqF; spf=pass (imf13.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666856390; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZRqVe/PVrFZfX/QWMS88IqK5P9boP5F4sKG29wjUYvo=; b=qmcsOjUe0oclEwqHqlwI7SUFhFtvu3MvWFHH7cu+PA60qELQ9/FjNDiunHhKhx7Irwk+mf QKf418e5Suo+pYW1vqrjXjXfcSq4mJvwLx0zraznBIvq4IdLmsT0f/ticyjScmGF6hW2g+ WoOprgh+eLLqWk/7xKHWtk7dFFSm9I4= X-Rspamd-Queue-Id: B01B720002 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=SPKndOqF; spf=pass (imf13.hostedemail.com: domain of ying.huang@intel.com designates 134.134.136.100 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam04 X-Stat-Signature: mi1jdugqqrpbcwchwgu65bjawyfbyj9y X-HE-Tag: 1666856389-754425 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Michal Hocko writes: > On Thu 27-10-22 14:47:22, Huang, Ying wrote: >> Michal Hocko writes: > [...] >> > I can imagine workloads which wouldn't like to get their memory demoted >> > for some reason but wouldn't it be more practical to tell that >> > explicitly (e.g. via prctl) rather than configuring cpusets/memory >> > policies explicitly? >> >> If my understanding were correct, prctl() configures the process or >> thread. > > Not necessarily. There are properties which are per adddress space like > PR_[GS]ET_THP_DISABLE. This could be very similar. > >> How can we get process/thread configuration at demotion time? > > As already pointed out in previous emails. You could hook into > folio_check_references path, more specifically folio_referenced_one > where you have all that you need already - all vmas mapping the page and > then it is trivial to get the corresponding vm_mm. If at least one of > them has the flag set then the demotion is not allowed (essentially the > same model as VM_LOCKED). Got it! Thanks for detailed explanation. One bit may be not sufficient. For example, if we want to avoid or control cross-socket demotion and still allow demoting to slow memory nodes in local socket, we need to specify a node mask to exclude some NUMA nodes from demotion targets. >From overhead point of view, this appears similar as that of VMA/task memory policy? We can make mm->owner available for memory tiers (CONFIG_NUMA && CONFIG_MIGRATION). The advantage is that we don't need to introduce new ABI. I guess users may prefer to use `numactl` than a new ABI? Best Regards, Huang, Ying