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 4472DC77B7E for ; Tue, 2 May 2023 16:15:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD2746B0074; Tue, 2 May 2023 12:15:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB32A6B0075; Tue, 2 May 2023 12:15:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC0026B0078; Tue, 2 May 2023 12:15:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by kanga.kvack.org (Postfix) with ESMTP id 8AD806B0074 for ; Tue, 2 May 2023 12:15:35 -0400 (EDT) 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-out2.suse.de (Postfix) with ESMTPS id 32F121F8BE; Tue, 2 May 2023 13:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683033139; 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=e34lyARZ09HKGFIQlEiAF8THiXo5avHNPJpnG3uakEc=; b=XA+fhfRdy1PVdokPNUnoo6eiG0HPFk9vPe17qeEuWqGZOV0d5f1CF7K2wwdCVsR4g+8CiM uzy9Rdh8/ntLrkaGAvy6HyfbDug2JW1840Gf1Qp+U1Wya0zG8lJUONVwTXyPt/x0RoWNZX A7sCN047xeZMeL85BgJI5rf61u1ztXk= 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 1404E134FB; Tue, 2 May 2023 13:12:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nO7aATMMUWTeUgAAMHmgww (envelope-from ); Tue, 02 May 2023 13:12:19 +0000 Date: Tue, 2 May 2023 15:12:18 +0200 From: Michal Hocko To: Vlastimil Babka Cc: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lorenzo Stoakes Subject: Re: mbind MPOL_INTERLEAVE existing pages Message-ID: References: <20230501185836.GA85110@monkey> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue 02-05-23 09:45:40, Vlastimil Babka wrote: > On 5/1/23 20:58, Mike Kravetz wrote: > > I received a question from a customer that was trying to move pages via > > the mbind system call. In this specific case, the system had two nodes > > and all pages in the range were already present on node 0. They then > > called mbind with mode MPOL_INTERLEAVE and the MPOL_MF_MOVE_ALL flag. Their > > expectation was that half the pages in the range would be moved to node 1 > > in an interleaved pattern. > > > > In the above situation, no pages actually get moved. This is because mbind > > creates a list of pages to be moved via: > > > > ret = queue_pages_range(mm, start, end, nmask, > > flags | MPOL_MF_INVERT, &pagelist); > > > > No page will be added to the list as queue_folio_required is called for each > > page to determine if it resides within the set of nodes. And, all page are > > within the set. > > > > I have reread the mbind man page several times and agree that one might > > expect MPOL_INTERLEAVE with MPOL_MF_MOVE_ALL to move pages and create an > > interleaved pattern. My question is should we: > > - Change mbind so that pages are moved to an interleaved pattern? > > I guess it could be worth trying, if there's a use case. And hope nobody > else is depending on the current behavior and will complain afterwards :) I am not sure this is worth it wrt. complexity. Essentially it would require to build up the distribution for the whole range first so 2 passes. Also it could become more tricky if the final node mask has nodes of difference distances (it would be a reasonable expectation to distribute withe minimum total distances right ;)). > > - Update the documentation to be more explicit? Yes, please. I do not think. While this sounds like a neat feature I think the additional complexity is likely not worth it. A strong usecase might make a difference though. -- Michal Hocko SUSE Labs