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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A553C2D0E4 for ; Mon, 23 Nov 2020 17:54:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF1272075A for ; Mon, 23 Nov 2020 17:54:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="EZyroN8Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387525AbgKWRyz (ORCPT ); Mon, 23 Nov 2020 12:54:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730906AbgKWRyy (ORCPT ); Mon, 23 Nov 2020 12:54:54 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5942DC0613CF for ; Mon, 23 Nov 2020 09:54:54 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id q16so18009719edv.10 for ; Mon, 23 Nov 2020 09:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IuMYUJdtH/2nxOl3I7w6Zr/wW7lBFGJLSxs8ekU48XU=; b=EZyroN8QsWMlG8MTbc4cEihy9jePh/EDRLIjidMYCh0AaOGMIsSZ+OIATwGTb7DrBg B0Y1wY8pXvHBi6kX0TuUMi2Fdaf8/jL0YYRk8gQBTf34tAYfi7wTZVQbICJ6erlFoTnn gInq2VWGc7qr88/qrPaiO2j8C7HaCasgFulEZuWEY+s4HTf5C89bIQH2CuSqqzHDwZLb SW1ZK7U1VKG+c+pTLi3qwYcop/T7aXkxdii36ISw06hkxzwkbqUfwSvgdRcVscA/1F2K HXzrUVMZ0qTJB8usXug7XfUu9DDeABr7dCAv3/Yq6EpSpY2b6FOKz09hxaYomrGi6hPi VJ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IuMYUJdtH/2nxOl3I7w6Zr/wW7lBFGJLSxs8ekU48XU=; b=bQITNgf+zK036dCUSYxjMKNbTr9HoNdI58V1D4fy8lrC3rpbU7brlJ9VF4PWoqOULQ z4h7dsjl0IEfQvnCWhKRHUXcMV9zwkhD3562Ff693CzxMaus8fFhUfE7kA9sVPt4k3Qf wjMoqMtynyMtvi4b4gt1peTjie7MTFcvhl1RfUC6aqBD0YmDpm7AWT60ApKtx58dfH5W FHXHQbZh5FmGEpNk8yzgnV1cjPpN9rL0fVmtjP7D0KqEWzRC2V11EpE0uxuhk4D7nmxo NOAbYC6ZNcrGktTi+7bsqAJujfsaWd1aSw8j61KSwaTyF33MLLIZNiNpxcp+B603je7Z Rbqg== X-Gm-Message-State: AOAM531pDKSDu/e3VX/bB+hDLIPcAbb9bQXlngI1/JBZkYDuSS6EUwcj MLpFLpgjhIvS2T9jh0G0XkfZF0t5efycNzrCfAtkbg== X-Google-Smtp-Source: ABdhPJx9togWcreQZq9uZt2NQSkdTVSANgXKGsHDuOkAlNfI9HveEvIYQVujmi34Dwt3OzWxuuRhLbvrCyUCRDN8+Jw= X-Received: by 2002:aa7:d54b:: with SMTP id u11mr309610edr.341.1606154092463; Mon, 23 Nov 2020 09:54:52 -0800 (PST) MIME-Version: 1.0 References: <20201123090129.GD27488@dhcp22.suse.cz> <20201123171502.GX244516@ziepe.ca> In-Reply-To: <20201123171502.GX244516@ziepe.ca> From: Pavel Tatashin Date: Mon, 23 Nov 2020 12:54:16 -0500 Message-ID: Subject: Re: Pinning ZONE_MOVABLE pages To: Jason Gunthorpe Cc: Michal Hocko , linux-mm , Andrew Morton , Vlastimil Babka , LKML , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23, 2020 at 12:15 PM Jason Gunthorpe wrote: > > On Mon, Nov 23, 2020 at 11:06:21AM -0500, Pavel Tatashin wrote: > > > What I mean here is allowing users to guarantee that the page's PA is > > going to stay the same. Sort of a stronger mlock. Mlock only > > guarantees that the page is not swapped, but something like > > You've just described get/pin_user_pages(), that is exactly what it is > for. You are right. No need for the madvise() flag at all. (The slight difference of being able to mark memory pinned prior to touching is really insignificant). > > I agree with the other emails, ZONE_MOVABLE needs to be reconciled > with FOLL_LONGTERM - most likely by preventing ZONE_MOVABLE pages from > being returned. This will need migration like CMA does and the point > about faulting is only an optimization to prevent fault then immediate > migration. That is right, as the first step we could just do fault and immediate migration, which is silly, but still better than what we have now. > > Jason 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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C0FC63697 for ; Mon, 23 Nov 2020 17:54:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13BBA20781 for ; Mon, 23 Nov 2020 17:54:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="EZyroN8Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13BBA20781 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3CD3B6B00C6; Mon, 23 Nov 2020 12:54:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 356306B00C8; Mon, 23 Nov 2020 12:54:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21D316B00C9; Mon, 23 Nov 2020 12:54:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id DEA7C6B00C6 for ; Mon, 23 Nov 2020 12:54:54 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 89DEA1EE6 for ; Mon, 23 Nov 2020 17:54:54 +0000 (UTC) X-FDA: 77516433708.28.spade75_471143b27367 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 30F456D64 for ; Mon, 23 Nov 2020 17:54:54 +0000 (UTC) X-HE-Tag: spade75_471143b27367 X-Filterd-Recvd-Size: 4152 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 17:54:53 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id l5so18002440edq.11 for ; Mon, 23 Nov 2020 09:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IuMYUJdtH/2nxOl3I7w6Zr/wW7lBFGJLSxs8ekU48XU=; b=EZyroN8QsWMlG8MTbc4cEihy9jePh/EDRLIjidMYCh0AaOGMIsSZ+OIATwGTb7DrBg B0Y1wY8pXvHBi6kX0TuUMi2Fdaf8/jL0YYRk8gQBTf34tAYfi7wTZVQbICJ6erlFoTnn gInq2VWGc7qr88/qrPaiO2j8C7HaCasgFulEZuWEY+s4HTf5C89bIQH2CuSqqzHDwZLb SW1ZK7U1VKG+c+pTLi3qwYcop/T7aXkxdii36ISw06hkxzwkbqUfwSvgdRcVscA/1F2K HXzrUVMZ0qTJB8usXug7XfUu9DDeABr7dCAv3/Yq6EpSpY2b6FOKz09hxaYomrGi6hPi VJ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IuMYUJdtH/2nxOl3I7w6Zr/wW7lBFGJLSxs8ekU48XU=; b=WwYXDCl0lNJoEiGjLUYGNjfRv+zG7O8XxrsR21Ln99d+EEiVH3k62OSGyzXmUjt3wo XSZg1Kc//qq2Y31c1ECY2nnkdK7X6t3ilCfw2hMMwHWuKMBI7F3WTICaoYDCNObEg/UK S196LIMF4p9BdkIYF6j9W+1BkvHWtJK6vC9G+87hmWrvisG7RNKy7eaMdIK7+f9UY78d cWP/dSEPlMC8omrMLaFtc0d1VioXzyDnuTN/KYEC9cqAuAIu56u11/xhtd+cwhxLP4TL /f48fz/BJk0lxNLyBfC0HmGeMda9TXvJZl+ylB8vFv/O8bAVdZ9C9qsB5ao7CiXkyGQP Cl6g== X-Gm-Message-State: AOAM532ljThUBAWnXmNqrvqklPZFLckL5CV3stctpf5qIUolep5Re/Ut c2PHR7YLoViIvy6K1N3ttJLbpK8pDgo+nQdlLmQ5qw== X-Google-Smtp-Source: ABdhPJx9togWcreQZq9uZt2NQSkdTVSANgXKGsHDuOkAlNfI9HveEvIYQVujmi34Dwt3OzWxuuRhLbvrCyUCRDN8+Jw= X-Received: by 2002:aa7:d54b:: with SMTP id u11mr309610edr.341.1606154092463; Mon, 23 Nov 2020 09:54:52 -0800 (PST) MIME-Version: 1.0 References: <20201123090129.GD27488@dhcp22.suse.cz> <20201123171502.GX244516@ziepe.ca> In-Reply-To: <20201123171502.GX244516@ziepe.ca> From: Pavel Tatashin Date: Mon, 23 Nov 2020 12:54:16 -0500 Message-ID: Subject: Re: Pinning ZONE_MOVABLE pages To: Jason Gunthorpe Cc: Michal Hocko , linux-mm , Andrew Morton , Vlastimil Babka , LKML , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , Stephen Hemminger Content-Type: text/plain; charset="UTF-8" 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 Mon, Nov 23, 2020 at 12:15 PM Jason Gunthorpe wrote: > > On Mon, Nov 23, 2020 at 11:06:21AM -0500, Pavel Tatashin wrote: > > > What I mean here is allowing users to guarantee that the page's PA is > > going to stay the same. Sort of a stronger mlock. Mlock only > > guarantees that the page is not swapped, but something like > > You've just described get/pin_user_pages(), that is exactly what it is > for. You are right. No need for the madvise() flag at all. (The slight difference of being able to mark memory pinned prior to touching is really insignificant). > > I agree with the other emails, ZONE_MOVABLE needs to be reconciled > with FOLL_LONGTERM - most likely by preventing ZONE_MOVABLE pages from > being returned. This will need migration like CMA does and the point > about faulting is only an optimization to prevent fault then immediate > migration. That is right, as the first step we could just do fault and immediate migration, which is silly, but still better than what we have now. > > Jason