Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp610469rwo; Wed, 2 Aug 2023 00:55:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTS/aUG3q9Iyq2t/+XVuZCsgNHBtjYGheMGY/DuDo/P3dPI0rtXo7d8O9SBgUhygxhstM+ X-Received: by 2002:a05:6808:bd1:b0:3a7:3b6c:ecb9 with SMTP id o17-20020a0568080bd100b003a73b6cecb9mr9431098oik.22.1690962936176; Wed, 02 Aug 2023 00:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690962936; cv=none; d=google.com; s=arc-20160816; b=bOE+ArTAzxXIZxeXhtoRiwIvebdRH20GKpd1VU+pipPcWVMg6HR2TQK7zaQBn8rzWl ro4+sVsE+3huXbsZBGQMsNUFH28NDh2SmfuM1TIX0Nqr/pCLEADV6N50saTmKOiu4Di2 GF4/g3EXp8Tdj+Onb95mhs/MmMNo5oNCNPL458jg73IfhkfFdrSZUHqRsv3iLZkvNjNS YTiAuRumfl2On6iOw6MZdmud7WlqkMY+5EEz9SlsVQ3U+9bGw37Lq/FxJubMiTZGpYos I9kg0o5Aehtrl59ZFnFvos4BxlKqS5SQ4LGXhb7kGTnD7SQfF2jm7bD3bgPrRp0kc+HQ YGKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=IK3aEBELlq1x3phTcf/ZsaDVc7hT1k6rf0vBkIgEPXc=; fh=/6EZCO92O2NjwaYVXEtV4/9r/jQeOWfVEUBoF1dwpdA=; b=IFIqK7hFvu99DrGVVXZygnFrQOn+KY5iLjjMZUX/6owQrajf/oS+eZb2r8Fcgwypvr C3bkY/sv3vNDIe2iL/L4a5uQfiXO5WnUAHUIy/JxYz9Z8C7aCteGxIHzh0QnN0pwX9bp /RIEQJBxW4HWEdfhEEBkt/rylwN4BEklRRUzWI7fWBCocjG02dwT1wwGeGK+4kLVOVLo gklORA+bPXzvY1kR2awfhvYjVS2JlpoTa4XHIl6iHiK9uoq58RDJqRusDgs7V20Mn1lq ecgsWbvWQcEP4Rab44nyi2qR8ve2ZC37n46uAO1pM7C0ox+5o3ILuEoVT46b03tgUNtJ whnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pr473z+o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi5-20020a17090b1e4500b00262f0035181si848383pjb.26.2023.08.02.00.55.24; Wed, 02 Aug 2023 00:55:36 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=Pr473z+o; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232400AbjHBGbk (ORCPT + 99 others); Wed, 2 Aug 2023 02:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232398AbjHBGbj (ORCPT ); Wed, 2 Aug 2023 02:31:39 -0400 Received: from out-122.mta0.migadu.com (out-122.mta0.migadu.com [IPv6:2001:41d0:1004:224b::7a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09EEF2704 for ; Tue, 1 Aug 2023 23:31:36 -0700 (PDT) Date: Wed, 2 Aug 2023 02:31:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690957893; 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: in-reply-to:in-reply-to:references:references; bh=IK3aEBELlq1x3phTcf/ZsaDVc7hT1k6rf0vBkIgEPXc=; b=Pr473z+oXbzMZnI8H/I7LVvXQV9wG8U4dZbKBe3GO0clA6n4ufvTxLMl7tbSVxVExQcRo8 E2SQPidb8c3SQ9nSKJk5xAX3p5AwQD8J2yu+jrf6U177qpC8Zvi0ZKsaUnioprO3HsnSoR XqACV00ARwzJ1G94/gTOP41ZZ9rVOVI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Nitesh Shetty Cc: Christoph Hellwig , Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, willy@infradead.org, hare@suse.de, djwong@kernel.org, bvanassche@acm.org, ming.lei@redhat.com, dlemoal@kernel.org, nitheshshetty@gmail.com, gost.dev@samsung.com, Vincent Fu , Anuj Gupta , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v13 3/9] block: add emulation for copy Message-ID: <20230802063124.4652m3gfbhdmghlt@moria.home.lan> References: <20230627183629.26571-1-nj.shetty@samsung.com> <20230627183629.26571-4-nj.shetty@samsung.com> <20230720075050.GB5042@lst.de> <20230801130702.2taecrgn4v66ehtx@green245> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230801130702.2taecrgn4v66ehtx@green245> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, Aug 01, 2023 at 06:37:02PM +0530, Nitesh Shetty wrote: > On 23/07/20 09:50AM, Christoph Hellwig wrote: > > > +static void *blkdev_copy_alloc_buf(sector_t req_size, sector_t *alloc_size, > > > + gfp_t gfp_mask) > > > +{ > > > + int min_size = PAGE_SIZE; > > > + void *buf; > > > + > > > + while (req_size >= min_size) { > > > + buf = kvmalloc(req_size, gfp_mask); > > > + if (buf) { > > > + *alloc_size = req_size; > > > + return buf; > > > + } > > > + /* retry half the requested size */ > > > + req_size >>= 1; > > > + } > > > + > > > + return NULL; > > > > Is there any good reason for using vmalloc instead of a bunch > > of distcontiguous pages? > > > > kvmalloc seemed convenient for the purpose. We will need to call alloc_page > in a loop to guarantee discontigous pages. Do you prefer that over kvmalloc? No, kvmalloc should be the preferred approach here now: with large folios, we're now getting better about doing more large memory allocations and avoiding fragmentation, so in practice this won't be a vmalloc allocation except in exceptional circumstances, and performance will be better and the code will be simpler doing a single large allocation.