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 95643C00140 for ; Fri, 5 Aug 2022 15:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 991148E0002; Fri, 5 Aug 2022 11:28:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 940358E0001; Fri, 5 Aug 2022 11:28:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 808298E0002; Fri, 5 Aug 2022 11:28:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6DD218E0001 for ; Fri, 5 Aug 2022 11:28:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 44ECE4057B for ; Fri, 5 Aug 2022 15:28:56 +0000 (UTC) X-FDA: 79765921872.07.045DA49 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id D6C2414000F for ; Fri, 5 Aug 2022 15:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659713334; 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=s17SDCL9MKLYF/3ndrof+ed7FioVUBYUF/ImBULyBsI=; b=GIxGLSZ6mLeNTcDYblSjbXW/hcnskWkfH7GgKQj2fQ1e6FZJQVybZh6ehuPKQjw7DXNCbE UIjOGXq7MinV33/sUbhXl+vefF9NiWNPkhIAOkazXEBSRevrSc3RFAFGnHegdVlxy1SbSZ gnCLTHgWOCljwFGQwbOi8An9FBTwUQE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-508-NKTw-W2SM36CpDEjzb0RXQ-1; Fri, 05 Aug 2022 11:28:53 -0400 X-MC-Unique: NKTw-W2SM36CpDEjzb0RXQ-1 Received: by mail-wm1-f71.google.com with SMTP id n19-20020a05600c3b9300b003a314062cf4so3623573wms.0 for ; Fri, 05 Aug 2022 08:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=s17SDCL9MKLYF/3ndrof+ed7FioVUBYUF/ImBULyBsI=; b=ZRtMWMMO5lZSGbD7mwGi7hXBjalDL01S9aamXwGD4C9kqU09BLtjXDfS/CZC1D5XXt SS5G+zOgLB6APmhaeMZo9xZm+s4O7gpvQI4aYIb3f29Eqjx122R4ZmhCY4pyN5+1GRgq 8SpEc6TTAnCD6JWxi8n8EAGIoQ5TgGDhBZOKXb+G0AR2o4I4U9DRXAby8o6FAB0KjnUW 0XGHXL57metKCS/ji63/H09bfBEUJROqoUFWzw/YjtvHipIAYqPHug/eiWV7lc+Nck9r kB2N6BniV/FKyZKFxYalLlOQDK3u/XRc3WJ/8pqkHecNr0G6jbmD6Nd46MSM2M+4+AEA 5/0g== X-Gm-Message-State: ACgBeo2zV1IQqu+zYZKsr0L38nUi+8B9oUilEWnXJm3y+J1/SCGXH5OL vNoZcuDFa/Jw4x+vsaRmIhfj8ags/88LCZNjeCmT+HVxS9AEGRiQiFj0rake5N6Z0iQozCGWs8E Xs4/9hlfMCYI= X-Received: by 2002:a5d:5343:0:b0:220:6203:ed4a with SMTP id t3-20020a5d5343000000b002206203ed4amr4485504wrv.146.1659713331905; Fri, 05 Aug 2022 08:28:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR6RP8jmEyNrgxdjMqN6pGfce2kXfKzdRs6fMoDWGxhWO4VNgKwbo4vWrf5CdNQijFgvKiR+Ag== X-Received: by 2002:a5d:5343:0:b0:220:6203:ed4a with SMTP id t3-20020a5d5343000000b002206203ed4amr4485489wrv.146.1659713331631; Fri, 05 Aug 2022 08:28:51 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:fb00:f5c3:24b2:3d03:9d52? (p200300cbc706fb00f5c324b23d039d52.dip0.t-ipconnect.de. [2003:cb:c706:fb00:f5c3:24b2:3d03:9d52]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c05c600b003a2eacc8179sm4879123wmd.27.2022.08.05.08.28.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Aug 2022 08:28:51 -0700 (PDT) Message-ID: <4437f656-99ac-400b-0d3b-4e1c7e6094da@redhat.com> Date: Fri, 5 Aug 2022 17:28:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: Arnd Bergmann , Li Chen Cc: Catalin Marinas , Will Deacon , Rob Herring , Frank Rowand , Andrew Morton , Li Chen , Linux ARM , Linux Kernel Mailing List , DTML , Linux-MM References: <20220711122459.13773-1-me@linux.beauty> <20220711122459.13773-5-me@linux.beauty> <181efcca6ae.de84203d522625.7740936811073442334@linux.beauty> <18267b7a61f.12b26bd91245310.4476663913461696630@linux.beauty> <1826852ea3a.10a917cc826728.6077661125986568031@linux.beauty> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH 4/4] sample/reserved_mem: Introduce a sample of struct page and dio support to no-map rmem In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GIxGLSZ6; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659713335; a=rsa-sha256; cv=none; b=tmmutEmJ/Cu/MT9buZPl82I2Esr2XQE21eGkKc542rrYclMvsm4UuKT6XGjuU5uyFrKY4P No9LG6dYYAF0BfakVoxmNK1l2SVm+pO/q0C5GjSeUV+kQNlzRumlwqAGLNrJZyKtC9Vn00 DJ2h9UJhRFxsc+3Ieqdtpw2UZKmkX14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659713335; h=from:from:sender: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:dkim-signature; bh=s17SDCL9MKLYF/3ndrof+ed7FioVUBYUF/ImBULyBsI=; b=ujq9cOW/7s4PrQP9AD6NDyoBGFk/D6ZKRLau1tm0PhuwA+BivNbruKkR19pzSf0whm9g/0 nAqX7IdMdFX4T9bYFSOolQgVK17yUQU4Cn2UFuPAc2UV8FofFxsdUxCLvlf0zx508nnadk hjJy2nh4u+cRnCCH8NeKfxUgSB42FaU= X-Stat-Signature: ju7w81qmegz1j49w5998pm6jm8bms4tf X-Rspamd-Queue-Id: D6C2414000F Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GIxGLSZ6; spf=pass (imf23.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1659713334-994140 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 05.08.22 16:09, Arnd Bergmann wrote: > On Thu, Aug 4, 2022 at 12:07 PM Li Chen wrote: > >> Apart from our cases, I heard there are some other cases where cma_alloc >> failed even non-cma system memory has enough memory because pages in >> CMA memory are pinned and cannot move out of CMA. There are some fixes like >> 1. move these memory out of CMA before pinned >> 2. only allow non-long-time pinned memory allocation from CMA. >> >> But these two solutions are not merged into the mainline yet. > > Right, I think this has come up before, not sure why it wasn't implemented. > My feeling is that 2. cannot work because you don't know if memory will be > pinned in the future at the time of allocation, but 1. should be doable. We disallow longterm pinning of CMA memory already and migrate it out of the CMA region. If migration fails, we reject pinning. See 9a4e9f3b2d73 ("mm: update get_user_pages_longterm to migrate pages allocated from CMA region") and recent 1c563432588d ("mm: fix is_pinnable_page against a cma page") It's worth nothing that is_pinnable_page() will be renamed to is_longterm_pinnable_page() soon to express what it actually means. Note that some FOLL_GET users (vmsplice, O_DIRECT) still have to be converted to FOLL_PIN, and especially also set FOLL_LONGTERM (vmsplice). -- Thanks, David / dhildenb