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 0102BC38A2D for ; Thu, 27 Oct 2022 07:10:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 945F28E0005; Thu, 27 Oct 2022 03:10:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F5768E0001; Thu, 27 Oct 2022 03:10:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BD1C8E0005; Thu, 27 Oct 2022 03:10:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 68B8C8E0001 for ; Thu, 27 Oct 2022 03:10:32 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E5B69AB968 for ; Thu, 27 Oct 2022 07:10:31 +0000 (UTC) X-FDA: 80065856262.03.BB137B0 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf22.hostedemail.com (Postfix) with ESMTP id 4E5E1C0018 for ; Thu, 27 Oct 2022 07:10:31 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B54DA22131; Thu, 27 Oct 2022 07:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666854629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QCPTXBtSuvGJ41I50Ajt8waPylXnOrME9Qo8riEvBNs=; b=XV2ShTSF4yMp1EabKplEgz+GtFZweYHSKQhHbBajveqkzRHYsGy8eq+D0MRC6mXFe20ADN TtCHe5UXI87D9NRXQWAii9m1kRipuCxXtgYrSAL8Egtf/cHPgQjj5R2D5kZwrQ/tlwGxBk hRiLB37+QpZjrTyXUkMZD7LMu/NYpAg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9765F13357; Thu, 27 Oct 2022 07:10:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zaWXGOUuWmOLHQAAMHmgww (envelope-from ); Thu, 27 Oct 2022 07:10:29 +0000 Date: Thu, 27 Oct 2022 09:10:28 +0200 From: Michal Hocko To: "Huang, Ying" 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 Message-ID: References: <20221026074343.6517-1-feng.tang@intel.com> <87wn8lkbk5.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wn8lkbk5.fsf@yhuang6-desk2.ccr.corp.intel.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666854631; 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=QCPTXBtSuvGJ41I50Ajt8waPylXnOrME9Qo8riEvBNs=; b=qjZhuhcDF/k3OjNq2YJrgJXB3rJynIAeixj+dnKFc0gH5VJXoxeX3mll7LSlRKsIebHCJz 0frW33vWpKjOWG/Re+OLNGFFrtPoVZZ1Lt/ieJNTxvY/fHmMH3vkVZ73kn9ti24BUlL8jB yhKu4u+FuGn96haYmUb332wku2wOjPU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=XV2ShTSF; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666854631; a=rsa-sha256; cv=none; b=6wYdg3IL0aX6xg2fnQywCLBmNJY8oTREod7hBapqlUpR3Jr4eEO8FbxOjLen6Su4on2hoM ekA6PStRienvWQ5TymIxecmbMWJQ3cSBK0UrZ9RwL1QeFj5YamHzYAd+/1J7ww1iFN0n4p Xnq0Sq7lV3Yvpax8oMedJ7Gv7nDzKcY= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4E5E1C0018 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=XV2ShTSF; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: od7z6hsusm1exqcbzdnza93wcg5ufoa5 X-HE-Tag: 1666854631-58974 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: 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). -- Michal Hocko SUSE Labs