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 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 2E70BC433FE for ; Fri, 4 Dec 2020 16:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D990A2223E for ; Fri, 4 Dec 2020 16:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730502AbgLDQKs (ORCPT ); Fri, 4 Dec 2020 11:10:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbgLDQKr (ORCPT ); Fri, 4 Dec 2020 11:10:47 -0500 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45B5BC061A4F for ; Fri, 4 Dec 2020 08:10:07 -0800 (PST) Received: by mail-qt1-x841.google.com with SMTP id l7so4251013qtp.8 for ; Fri, 04 Dec 2020 08:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VgRFU7+U3dcM21Ber7g78naiXHMx8/x0mx6S23m379c=; b=TxQQ3A4gPUb/c6DaNSH8sSZrpSZ6sh+4Kao8BUigB8ZB0+dG67Z7ykp2uwIWWShMWk UKN+qrOzqwIa1PPeKfy+NpjPfj04Ckq6aAHGudbjMJHEotnoqGM+emLLcQh1+ECQ7lbg 1I4RWNBxawpsn4sERFYuKUnYJmx+QJnUXAQgtXZ+GYcfI7xeMKvpo1tnhquqzHMp6G95 TpTsY3FOT91lCb0ofY3U/iMb+WVfV2Av8BcKN05VanSsIInlyn/ntD7UlBwoA4RzoeGX +zRTNsADj7a0zPLZ5xa+CWuiPQlu28cMhvJb9o1ykX60oLPDmsHXlwEXGAVBEqqILXEn +bqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VgRFU7+U3dcM21Ber7g78naiXHMx8/x0mx6S23m379c=; b=ZXG0Kosm9JF63wlAImNeIhiQCQUgfj6+fyskWU94yPjqBVMDbU6DXmTSH4P21s9pXq vWQRb5pSN3y9CS13IvVNhyAkAlxos9DkjXvMjl+OlAAEMY2Lt7dcbDU2HAVgJHmSu4aZ EBwS/eCAqbKF9YdewGXns2wELfClCaKbgblza1XPxCdUkAFj8NntwbIxjFcKL8gbSbww Wk0qvPrzvBHLxjsrzH4ErzFfm7rCjHL+1eNSSMGRylre2DGEWYJf+GxpFB1WJbESxQb9 trdwy4bN9Se1lrE+sqmbOezHyXfMlcrwCB+cU8uHlTMIR7wuEeqU0bioeMqsUyIEvCYe Np1g== X-Gm-Message-State: AOAM531Zh89afxCmy88KBzotqX6k/N1MiJYqpqakS1B6whC+kpi11HW4 I6/Up0aXQAV/b5ktR5kqT9Q7AQ== X-Google-Smtp-Source: ABdhPJyJBAEvJJb4cjudhvvR8M4t3aSdim44E4b1pefhuATcOoSqitkM9LGsEmvZ/5HNVRh6F6PjXA== X-Received: by 2002:ac8:4f11:: with SMTP id b17mr10092063qte.338.1607098206515; Fri, 04 Dec 2020 08:10:06 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id z20sm5167491qto.40.2020.12.04.08.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 08:10:05 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1klDen-005vbe-3D; Fri, 04 Dec 2020 12:10:05 -0400 Date: Fri, 4 Dec 2020 12:10:05 -0400 From: Jason Gunthorpe To: Pavel Tatashin Cc: Joonsoo Kim , LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard Subject: Re: [PATCH 0/6] prohibit pinning pages in ZONE_MOVABLE Message-ID: <20201204161005.GD5487@ziepe.ca> References: <20201202052330.474592-1-pasha.tatashin@soleen.com> <20201204035953.GA17056@js1304-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 10:55:30AM -0500, Pavel Tatashin wrote: > On Thu, Dec 3, 2020 at 11:03 PM Joonsoo Kim wrote: > > > > Hello, > > > > On Wed, Dec 02, 2020 at 12:23:24AM -0500, Pavel Tatashin wrote: > > > When page is pinned it cannot be moved and its physical address stays > > > the same until pages is unpinned. > > > > > > This is useful functionality to allows userland to implementation DMA > > > access. For example, it is used by vfio in vfio_pin_pages(). > > > > > > However, this functionality breaks memory hotplug/hotremove assumptions > > > that pages in ZONE_MOVABLE can always be migrated. > > > > > > This patch series fixes this issue by forcing new allocations during > > > page pinning to omit ZONE_MOVABLE, and also to migrate any existing > > > pages from ZONE_MOVABLE during pinning. > > > > I love what this patchset does, but, at least, it's better to consider > > the side-effect of this patchset and inform it in somewhere. IIUC, > > ZONE_MOVABLE exists for two purposes. > > > > 1) increasing availability of THP > > 2) memory hot-unplug > > > > Potential issue would come from the case 1). They uses ZONE_MOVABLE > > for THP availability and hard guarantee for migration isn't required > > until now. So, there would be a system with following congifuration. > > > > - memory layout: ZONE_NORMAL-512MB, ZONE_MOVABLE-512MB > > - memory usage: unmovable-256MB, movable pinned-256MB, movable > > unpinned-512MB > > > > With this patchset, movable pinned should be placed in ZONE_NORMAL so > > 512MB is required for ZONE_NORMAL. ZONE_NORMAL would be exhausted and > > system performance would be highly afftect according to memory usage > > pattern. > > > > I'm not sure whether such configuration exists or not, but, at least, > > it's better to write down this risk on commit message or something > > else. > > Yes, this indeed could be a problem for some configurations. I will > add your comment to the commit log of one of the patches. It sounds like there is some inherent tension here, breaking THP's when doing pin_user_pages() is a really nasty thing to do. DMA benefits greatly from THP. I know nothing about ZONE_MOVABLE, is this auto-setup or an admin option? If the result of this patch is standard systems can no longer pin > 80% of their memory I have some regression concerns.. Jason