Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp578803pxu; Fri, 4 Dec 2020 10:07:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdZy29yaY1yzSeE7dK5ppgEY4tmahkw3tDd0igipKXrKLUjGxLL18fzr8cqaVmYbbcq6xz X-Received: by 2002:a50:d1d3:: with SMTP id i19mr8258579edg.297.1607105277573; Fri, 04 Dec 2020 10:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607105277; cv=none; d=google.com; s=arc-20160816; b=S17wvg1tJ3lmUdlzHonux9due6PcAwYh6Gu6xElMkOEBUtWhtxcLvUV0MYx0wjHpng QFGMBFTSROCvoiANCyB3vK3ijZFrBE8ImZPKEekTeJUZ0+U8h3BLI3uN2sm334swHkLB GNgtSta+KVn4FGnWT4LxO98UbbGJKXUn3xpIsPmgEQU4w0a2Zj3MRqVy0tXw4hoMjOvE b1XlzNHPwV0t12fDutLTRzXPq+oO7/C/BNMu2gLuJHASLoQaksVgaO9EczrX/JO66yjM FSIoJNl4BW2owDg8JPaIwqtrXEyxBEuOWiFse+9wT3SNqUrvHauXpnM0xzMoq7R0HA+E 3v6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=Y+BVWlwmMR3/aIwVc1YDREePfrqw3RI1zvIRL+z1PQU=; b=DM/0ntADfWaS4gdTlDgsCnlU4E8xn7YErVSnmyDkkCN9qjxnT9gbC8WEUjs3LrLfaR 1d+BriwhXzAXXeJ0kFP/i/w9Wt3oJjyABr2Lil6sFWW+FCX2bGt3jH38gkUrGUfkqNWK EJKsIketWX9c0/3OAsj/FnI0Bpe6ujpsajCgitrOq/wOH6DogEPAb392CbjsxUeE2EFT v6pxHevbJoiNXOuTYXrNfH/00OA1+CSVJwaPCGwlan6MmNBQIR0AsG7EbKGcbeF7oULU MXy1OXBC3WvJ/1VlvGzTJQoZwlnBapN0+DQ9sVK6q7Vj1g59KE92srgjUxMFHfJlCQ0+ StLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CN/S9OXX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si1736351ejc.540.2020.12.04.10.07.33; Fri, 04 Dec 2020 10:07:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="CN/S9OXX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729132AbgLDSDh (ORCPT + 99 others); Fri, 4 Dec 2020 13:03:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52997 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbgLDSDg (ORCPT ); Fri, 4 Dec 2020 13:03:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607104930; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y+BVWlwmMR3/aIwVc1YDREePfrqw3RI1zvIRL+z1PQU=; b=CN/S9OXXEezRQ18LU9n70IbARdk3xJf2pRSuZO+Uiv4mZBTmVe7+rYA8w6uhcrobNCCEDU yy+M2dSBcyLIks7FoWNKnXX5REgTQleThlNts6iWr6VQUQ2YfBUADYP5EAKdbDWjj9TK+L HmpBNQSyoS8hbdbeGvgI5RhIrI2Tuxg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-PzeVPaOdO6GNlahLGsOC3w-1; Fri, 04 Dec 2020 13:02:06 -0500 X-MC-Unique: PzeVPaOdO6GNlahLGsOC3w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8ADAD1005513; Fri, 4 Dec 2020 18:02:03 +0000 (UTC) Received: from [10.36.112.162] (ovpn-112-162.ams2.redhat.com [10.36.112.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76B7C5D6A1; Fri, 4 Dec 2020 18:01:59 +0000 (UTC) Subject: Re: [PATCH 0/6] prohibit pinning pages in ZONE_MOVABLE To: Pavel Tatashin , Jason Gunthorpe Cc: Joonsoo Kim , LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , 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 References: <20201202052330.474592-1-pasha.tatashin@soleen.com> <20201204035953.GA17056@js1304-desktop> <20201204161005.GD5487@ziepe.ca> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <593822e5-4e1a-fdca-5500-4138d0f2b728@redhat.com> Date: Fri, 4 Dec 2020 19:01:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.12.20 18:50, Pavel Tatashin wrote: >>> 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.. > > ZONE_MOVABLE can be configured via kernel parameter, or when memory > nodes are onlined after hot-add; so this is something that admins > configure. ZONE_MOVABLE is designed to gurantee memory hot-plug > functionality, and not availability of THP, however, I did not know > about the use case where some admins might configure ZONE_MOVABLE to > increase availability of THP because pages are always migratable in > them. The thing is, if we fragment ZONE_MOVABLE by pinning pages in > it, the availability of THP also suffers. We can migrate pages in > ZONE_NORMAL, just not guaranteed, so we can create THP in ZONE_NORMAL > as well, which is the usual case. Right, we should document this at some place to make admins aware of this. Something like "Techniques that rely on long-term pinnings of memory (especially, RDMA and vfio) are fundamentally problematic with ZONE_MOVABLE and, therefore, memory hotunplug. Pinned pages cannot reside on ZONE_MOVABLE, to guarantee that memory can still get hotunplugged - be aware that pinning can fail even if there is plenty of free memory in ZONE_MOVABLE. In addition, using ZONE_MOVABLE might make page pinning more expensive, because pages have to be migrated off that zone first." BTW, you might also want to update the comment for ZONE_MOVABLE in include/linux/mmzone.h at the end of this series, removing the special case of pinned pages (1.) and maybe adding what happens when trying to pin pages on ZONE_MOVABLE. -- Thanks, David / dhildenb