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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27195C25B08 for ; Fri, 5 Aug 2022 15:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238116AbiHEP25 (ORCPT ); Fri, 5 Aug 2022 11:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237901AbiHEP24 (ORCPT ); Fri, 5 Aug 2022 11:28:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 59A2321245 for ; Fri, 5 Aug 2022 08:28:55 -0700 (PDT) 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-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-Qv0MxD0AN7K86g1rGvt-AA-1; Fri, 05 Aug 2022 11:28:53 -0400 X-MC-Unique: Qv0MxD0AN7K86g1rGvt-AA-1 Received: by mail-wm1-f72.google.com with SMTP id d10-20020a05600c34ca00b003a4f0932ec3so4364739wmq.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=VTlxjlcvgaVCYs0O9CQCotKZYa+vHuYlKC1bZce8gqRJbej0yPMVexeNQGmm2am6x/ 5sF1sLOHAv1IZmymcRGRrXksAuUl+m9yu+PuLW1C3bwrQXeqxayFrobsCXLTdVmx26N9 ShFQwpfwl2DjLKunnR5F7Jaw/O3cL0+dLKgd2nLsNr8B7jRRm++nirgU4XQx1ffiL10g clp/FbFaSj+4Yq0M5AXZmMGX3hHlDl+OKBADDEVKwwk1S4c9SCnVAp7f1T7JhNXzqVBQ rAnRZNIejsqa9z/5fOlI/ngVFHCJbHBoY6BqBRs5pza6CWdZXA3X40IQ3WBhRPSqJM5F Uzwg== X-Gm-Message-State: ACgBeo0jjo3RUIvAUuEPk6t4MppJNGD41YlJVBW4dTsSEjwoVtc+cT3Z 6z/7t8uI82Hsr1k/oUJrc1X2ewD8a9n8HTk7k33qwKtByycim13j1SeVyN1T0cqmQxhkwmNTVU+ 0qBJNqLuotGfWj0+kxc5nzg== X-Received: by 2002:a5d:5343:0:b0:220:6203:ed4a with SMTP id t3-20020a5d5343000000b002206203ed4amr4485510wrv.146.1659713331913; 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 Content-Language: en-US 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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