Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp309336rwi; Thu, 27 Oct 2022 01:16:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pamVbJg0frc/942H0jyWTcPK8aN4E+taBK2u0YId/94tEsdwojxqJ83N2hvqNhFMne1F3 X-Received: by 2002:a17:907:6e87:b0:78f:a596:5cf6 with SMTP id sh7-20020a1709076e8700b0078fa5965cf6mr40494123ejc.398.1666858571494; Thu, 27 Oct 2022 01:16:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666858571; cv=none; d=google.com; s=arc-20160816; b=BSvL1RaEowoGbNwFyp+1KMCrht6Is6cgQaLtJKmmVWujeX63aYCGIm4SV4EmZKuro5 XZiwfpJZ3pScnTbNwoP1aVIL8mGtmQBg3w0glCAylJ10ta1MWTJQsBHOHAT0RSbj9bAi onlAer+8n8ry/36hw6V1eGgdvO74y0hyTm/trMAKJc5bHsw+XRZoL9hz/snaxayDklec AwoQMpjNsCVv+JSDTmcpTaZK3eOi+5gJ8R8LVrhgIp4HoBWowdjqgZlbBS8FIEdU8sad q3qusBuyUq8YVoVdTMsugBJKfD74xFunHSAZYRtxnJOTSzCqmUiWc5Xoidaq6Edw/q0C NSrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=ZRqVe/PVrFZfX/QWMS88IqK5P9boP5F4sKG29wjUYvo=; b=jZ9zUMNMqCxnA8I/L2JSG8c+ovPr/xJMcVfe/AB9RA05LZ0RjQKTfNyyYtFcDRJztZ k9Jcih5NtTGBApH6zL0X6+YcVcTJxYB7PPfu9sX9b4IGoYFd6aw+o3RVq07eEgmdFyeA YHtfFw/8gCCs7nGlFxo3v+WEuXTM3dlP122zaBV7Mlo896mH/tjKj0zCWPLXT5YIThen HQWJuXQxxwEaft5anv11wNc5tVrnXhwSsMpNhd1ewOr1ir3vV4RFGdPGL+Wjx3FmTCcB XqUtw06rdPI0tHY1ZIFFxaCtJzHU6Mds1UIjKx6AdtpwpiTFSYMozGtt61y7vVnC0L0g MMlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BdCDXRUb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a50eb41000000b00447d6f244c6si902957edp.248.2022.10.27.01.15.43; Thu, 27 Oct 2022 01:16:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BdCDXRUb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234805AbiJ0Hju (ORCPT + 99 others); Thu, 27 Oct 2022 03:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234596AbiJ0Hjt (ORCPT ); Thu, 27 Oct 2022 03:39:49 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4622F2A250; Thu, 27 Oct 2022 00:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666856388; x=1698392388; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=jweFWZMSXgqQ6tBTe/QKSoQxmkPbv29fClDdATqJ80E=; b=BdCDXRUb2vVUxO8Smrn4RhyqAaRdb0nRBKtrpMdJ0pJMtGoMcnehdKCL voaHKd6tLGBvIk9y9oqpBBntTI8GTf+VdueqLSmpj+nbQlESqqrpMthoJ F1h8TRNsl5Qpm3011kaBG8oS5KT1dCjI8njVvIG3ercfnFqmom3cYGT8x s7qSumZG6eVdoOgx4IIafpp4MHEQnvuoXdXBCWLVWQL5WlE0azcJEDeJ6 SjXwb28ZTEqCFstvMzy2iCPwrnN8Y0JZ4sc3obp49JTfTJKHzcSQLE8zJ tm3+qV9T2D2YkBTDVNek/3RBtFRQ7ILpRZXtVMn++XspCVfS/lmDv0uRA A==; X-IronPort-AV: E=McAfee;i="6500,9779,10512"; a="308148216" X-IronPort-AV: E=Sophos;i="5.95,217,1661842800"; d="scan'208";a="308148216" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 00:39:47 -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 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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