Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp186919rwb; Thu, 18 Aug 2022 01:51:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR64vqAHywgaG+X8Nv8hXTS+2ieLo5haQAtCupn7t3gE8O9O3wel7W9dYWu0LsZiMltWggBL X-Received: by 2002:a17:907:7fa1:b0:734:b26a:17bc with SMTP id qk33-20020a1709077fa100b00734b26a17bcmr1265594ejc.157.1660812669108; Thu, 18 Aug 2022 01:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660812669; cv=none; d=google.com; s=arc-20160816; b=dnuUVT2RiOCn6WtY3s2vWwvmW9YzckZHp7s2PnoP7NE8b/iNqU8Vy/mMcKFksTxwvf huPieGon9ymDrDZz/T3TdQeuntUzuEKXw3YjesewSgAbxqwOZLmKiO75yt7rWdub4eL7 xubJejHR+P9dy/3Zcmtc4wwgxbA9KN02w3SzqFme1eu9DFuEr9cgNMxMkp2464VU0kOA R3YrXc54t+hO/+cptx2MkYKpjQ2DDw1JYUl1VVFjqrJlmd2XDtidTM8clIGmrkkpI1eE o0cpvnN0P2FYaNGFyGl8pyHD8DelB/61skNwD+kyV5h+ssOZm/EGXnNBsqyoVHkrt6Xk eBIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=1Bmj/qOCjWJh/Ir9RrTFSW8lcd8ZIw8uIToAw5xclCY=; b=GwLLn7r8JiJRp4YsUJFBL9S+5Za41BW8zTGF4+2Nmj3VmxqxNO83NTqwLod+9Lea81 iqPmEZ2jT2igs7MJm4fccYdwb4k/6sAhNYKDbKWeXMbWPPDNi0yfiXoPkxjCH2qev0dc c3Ymxlejl9LxYOdklF6Ip4Jtga7GUfcFalG56IvRhPZzye9pRmF8r/xW6nAqFHhHbriS KbjsR/fhUVvKzY2ZvAjlIIVDK2ipjkZPNAzUhgaI8eKO4SsMq5+u4cEnB3VDXbdcjo3U BJJ87H/koRFVBTN9lJBrkjaG66fQDokhcUwfQwbtC2nYqiWCT7Cdwyw8w2knp+u7iTtc SH4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020aa7ccd5000000b00443d657d8d7si725703edt.220.2022.08.18.01.50.43; Thu, 18 Aug 2022 01:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241660AbiHRIhw (ORCPT + 99 others); Thu, 18 Aug 2022 04:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231424AbiHRIhu (ORCPT ); Thu, 18 Aug 2022 04:37:50 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B016B02AA for ; Thu, 18 Aug 2022 01:37:49 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VMZx3Mr_1660811864; Received: from 30.178.80.93(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VMZx3Mr_1660811864) by smtp.aliyun-inc.com; Thu, 18 Aug 2022 16:37:46 +0800 Message-ID: Date: Thu, 18 Aug 2022 16:37:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH v2] mm/dmapool.c: avoid duplicate memset within dma_pool_alloc To: Christoph Hellwig , Robin Murphy , akpm@linux-foundation.org Cc: Marek Szyprowski , "linux-arm-kernel@lists.infradead.org" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "iommu@lists.linux.dev" References: <1658125690-76930-1-git-send-email-liusong@linux.alibaba.com> <1dbe63ff-5575-745b-653a-a992ae53e1aa@samsung.com> <413d8666-7a82-efd7-6716-13658016ca10@arm.com> <20220817053628.GA28747@lst.de> From: Liu Song In-Reply-To: <20220817053628.GA28747@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A helper function "use_dev_coherent_memory" is introduced here to >>>> determine whether the memory is allocated by "dma_alloc_from_dev_coherent". >>>> >>>> And use "get_dma_ops" to determine whether the memory is allocated by >>>> "dma_direct_alloc". > WTF? get_dma_ops is privat to the DMA API layer, and dmapool has no > business even using that. Even independent of this particular case, > consumers of an API never have any business looking at the implementation > of the API, that is the whole point of the abstraction. > >> It's not even that, the change here is just obviously broken, since it ends >> up entirely ignoring want_init_on_alloc() for devices using dma-direct. >> Sure, the memory backing a dma_page is zeroed *once* by its initial >> dma-coherent allocation, but who says we're not not reallocating pool >> entries from an existing dma_page? > And yes, in addition to that it also is completely broken. After reading everyone's comments, I found that fixing this patch will make the code look strange, so the benefits of the changes will be dispensable, so I also agree to discard this patch. Sorry for this trouble again. Thanks