Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp256677rwi; Thu, 27 Oct 2022 00:20:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Jq+DbEl+jk/UoqlxIHl8P13HBB7s+KpPz56aWr29rLqS6Wn+9JWMGCgPSOwMYqXNymEh5 X-Received: by 2002:a17:907:3da2:b0:78d:51c4:5b80 with SMTP id he34-20020a1709073da200b0078d51c45b80mr40152668ejc.716.1666855213544; Thu, 27 Oct 2022 00:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666855213; cv=none; d=google.com; s=arc-20160816; b=EOjQNtNRZW1jiCchf0RNzHrILNuOkBjtmWzd2436pghFZbtuJo3yniqDQ86C60TcN5 zqfrivYJMNObOTCzoXy2BVoWQcoExmi3E1PF8IDW7Hxt3s25DHuL0Tan5CdnCsX7JaIB TwgnWNIivpx64YN/LO7RBuEOh++/9HI3zNyK50LPDFMb1DAeZYL1RIjGaqkH1AHPfVDO 2WHbNpTU/grCSWE4hohsB9tDflCkPUAcOm2pC5hPKdhicYRHSMhGimsQvjwrz9qElES/ N+NcY3zbQWVWunhJRhe6QOlhIR4fMK9RiFgwaNpZeWcTFjLiS0GqxYw8JUpr3L6HLEBP reKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QCPTXBtSuvGJ41I50Ajt8waPylXnOrME9Qo8riEvBNs=; b=m98wn6Czeaavg5g+A1OCjYzODcUcuFdBVPHe/CgsbmMpDxIIIWmZiqce16it0rGtzg qWtlUDWoEO2viuaIqzAoLz5pN7d7dWq5x6ablom6nawa5F6Q7mo7AFD89E+qg5xDDwQc f8I8+Kmvf3tbiujHaF+ra1OjHvwT1IxA7syohCdPS4+OD1aHyIyF4NfF9E7b3S4SNwBB 1ISlpufM4RdZbbjnmosNwDhlebcyjdB17HU8sw2sF3HwsvRc/m6ko9fG1RwkocnbtQPA yU14n90StLVwm8//YPtyMVap6IDXWZ58Mr7X3ihd4G70kC6t9AvrkX0Eo70O31X1RZjg OV3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XV2ShTSF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a05640217d000b004616acd9cbcsi846549edy.360.2022.10.27.00.19.48; Thu, 27 Oct 2022 00:20:13 -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=@suse.com header.s=susede1 header.b=XV2ShTSF; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232844AbiJ0HK5 (ORCPT + 99 others); Thu, 27 Oct 2022 03:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbiJ0HKx (ORCPT ); Thu, 27 Oct 2022 03:10:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DC93635C2; Thu, 27 Oct 2022 00:10:31 -0700 (PDT) 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 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