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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF80AC17440 for ; Sat, 9 Nov 2019 03:02:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AEEA214DA for ; Sat, 9 Nov 2019 03:02:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725895AbfKIDCa (ORCPT ); Fri, 8 Nov 2019 22:02:30 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40349 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbfKIDC3 (ORCPT ); Fri, 8 Nov 2019 22:02:29 -0500 Received: by mail-pl1-f193.google.com with SMTP id e3so5140062plt.7; Fri, 08 Nov 2019 19:02:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Q9w9/CL3tvrcZwNSUDDdOh70mNMnFLTdHmVRbGH/fsQ=; b=RhkDx30JD54fYQo9hP8I2p1pTObKb63mZVBQBWqpUxZUL/9hzxk97nBljGD0tAAAN3 2jKcOpyi71U7i0KEh6INLZ73cCGICF1H7Fb+M6GWNZ4LE8RFulhX8R1Tn0zODqLC6b6n b9OujTqi7eTHKE3f22ftHVEzmvez3PIhyhke4IR9A+dLN3OVtR0Fbo9KOrbD9YAeByTe aPcJ3YOXeaMRVD/dAK9zLSDIv9/3b9jC5hiiKw8uVpsz1dIN1ZOPNLgq5xqcsFQuL6lE exe6I+dmMJVOJC3yUhPQNFhGoh5oabAs2czDm3CQv4aSagmE8QQmecdTfcE3D8k7F1ew QAJg== X-Gm-Message-State: APjAAAUKgBIOSh+tv9mb8I+dgwmtPc6YoN0yNMKbgGNmhWZ+SzkNAkiL 64fXCaPQiInkr0niho7A+t0= X-Google-Smtp-Source: APXvYqznA2/Hflt4r+QC31lnQ7K+Dgy87EIN0nH4QqGDSy7xTZp2MWCmVVsOPoz64ej9OUuavrLuaw== X-Received: by 2002:a17:902:b482:: with SMTP id y2mr5337175plr.128.1573268548891; Fri, 08 Nov 2019 19:02:28 -0800 (PST) Received: from localhost.localdomain ([2601:647:4000:a8:64c1:7f03:d411:a61]) by smtp.gmail.com with ESMTPSA id d8sm6983723pfo.47.2019.11.08.19.02.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2019 19:02:28 -0800 (PST) Subject: Re: [dm-devel] [PATCH 8/9] scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer() To: Damien Le Moal , "linux-block@vger.kernel.org" , Jens Axboe , "linux-scsi@vger.kernel.org" , "Martin K . Petersen" , "dm-devel@redhat.com" , Mike Snitzer , "linux-f2fs-devel@lists.sourceforge.net" , Jaegeuk Kim , Chao Yu References: <20191108015702.233102-1-damien.lemoal@wdc.com> <20191108015702.233102-9-damien.lemoal@wdc.com> <6a1e0a08-d65c-b075-9bac-23519e9e91c3@acm.org> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxM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AAK CRBxXD01xc4QCZ4dB/0QrnEasxjM0PGeXK5hcZMT9Eo998alUfn5XU0RQDYdwp6/kMEXMdmT oH0F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <639eae70-bb57-0c49-0ae9-aed8d33df271@acm.org> Date: Fri, 8 Nov 2019 19:02:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 2019-11-08 18:54, Damien Le Moal wrote: > On 2019/11/09 4:06, Bart Van Assche wrote: >> On 11/7/19 5:57 PM, Damien Le Moal wrote: >>> - buf = vzalloc(bufsize); >>> - if (buf) >>> - *buflen = bufsize; >>> + while (bufsize >= SECTOR_SIZE) { >>> + buf = vzalloc(bufsize); >>> + if (buf) { >>> + *buflen = bufsize; >>> + return buf; >>> + } >>> + bufsize >>= 1; >>> + } >> >> Hi Damien, >> >> Has it been considered to pass the __GFP_NORETRY flag to this vzalloc() >> call? > > Do you mean using > > __vmalloc(bufsize, > GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY, PAGE_KERNEL); > > instead of vzalloc() ? (since we cannot pass GFP flags to vzalloc()...) > > Note that this is called with GFP_NOIO set for the caller context in the > case of revalidate zones, and default to GFP_KERNEL for > blkdev_report_zones() unless the caller also tweaks the context memalloc > flags. Hi Damien, Yes, that's what I meant. The following comment from mm/util.c explains why __GFP_RETRY should be used if it is OK for an allocation to fail: /* * We want to attempt a large physically contiguous block first because * it is less likely to fragment multiple larger blocks and therefore * contribute to a long term fragmentation less than vmalloc fallback. * However make sure that larger requests are not too disruptive - no * OOM killer and no allocation failure warnings as we have a fallback. */ Thanks, Bart. 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 X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28FA0C17441 for ; Sat, 9 Nov 2019 03:02:39 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E37CA214DA; Sat, 9 Nov 2019 03:02:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="hZPNL94Q"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="FgQ0Fmag" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E37CA214DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1iTH1J-00055M-BL; Sat, 09 Nov 2019 03:02:37 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iTH1I-00055F-4g for linux-f2fs-devel@lists.sourceforge.net; Sat, 09 Nov 2019 03:02:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q9w9/CL3tvrcZwNSUDDdOh70mNMnFLTdHmVRbGH/fsQ=; b=hZPNL94Qqjjvel0hKW4IaNzX78 9LhURFGPrH1R8eD8h9l2u1ecKneil416RB0mnxG8vAwZKJuZa1bObE8/05wa9sk3ocuXu9x4kzZe4 Y73ucFR8jCAj+E5L167Wg3Kfxkujo/t2Ahxm00IJytx9A8MuJ9iZg9wDA38IxOjKlBiI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Q9w9/CL3tvrcZwNSUDDdOh70mNMnFLTdHmVRbGH/fsQ=; b=FgQ0Fmag5wXPe6nch7el3fAC2Q IDydiWd49o+QvkU7PoqhAj/3FsBoOELKiBzbxwkDW2hRlrE/G9gl/6CBPvAwpnHilpFuN87HgC2g0 fdVnqQyRYBgjf+0Wsr57JGdHWCk7ke9kQNMyPOEuKtUY8cbw8k4G/aRSWMuMhpJNXRAY=; Received: from mail-pl1-f193.google.com ([209.85.214.193]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1iTH1G-007jDF-S9 for linux-f2fs-devel@lists.sourceforge.net; Sat, 09 Nov 2019 03:02:36 +0000 Received: by mail-pl1-f193.google.com with SMTP id ay6so5168147plb.0 for ; Fri, 08 Nov 2019 19:02:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Q9w9/CL3tvrcZwNSUDDdOh70mNMnFLTdHmVRbGH/fsQ=; b=FFtS1e2dOby46DNR9XwC8JSjaCfyE5GpbCZj4Qf14HfKUN5ldJUcmFEguKW6tM450X ZMoD4FVYpukP5FWOxTBEkTg8vpPlTZG8bPSnVnj+VvTUleBKR3nd75zA1ZFJmHlMNomS /NDTUKNxDkOynGCmT98vu4USI2PAiAcjWXyUbIDLSUKVPbL/Pssl32YZjlSgpdrbYMOo mPGzRfb5N7X1OTxha6Tv3j2PrxfFUWAvMhyAScnd10KehF0hwfLnI4Dw9HB70vHqTvFN qQJ8bbRDFK1/b8slM03MMp6gWgP3p2Y+xzcIypaOFF1z0qpJt3MYSafC+aNpL4Z4Z6sI n1qg== X-Gm-Message-State: APjAAAUhSsg0y4FqzRMMaMR+bVM9xKOiOANvvyiq/GZy1UIToqzGyl0H PbkCTZy4z6muBzKraWDI7is= X-Google-Smtp-Source: APXvYqznA2/Hflt4r+QC31lnQ7K+Dgy87EIN0nH4QqGDSy7xTZp2MWCmVVsOPoz64ej9OUuavrLuaw== X-Received: by 2002:a17:902:b482:: with SMTP id y2mr5337175plr.128.1573268548891; Fri, 08 Nov 2019 19:02:28 -0800 (PST) Received: from localhost.localdomain ([2601:647:4000:a8:64c1:7f03:d411:a61]) by smtp.gmail.com with ESMTPSA id d8sm6983723pfo.47.2019.11.08.19.02.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Nov 2019 19:02:28 -0800 (PST) To: Damien Le Moal , "linux-block@vger.kernel.org" , Jens Axboe , "linux-scsi@vger.kernel.org" , "Martin K . Petersen" , "dm-devel@redhat.com" , Mike Snitzer , "linux-f2fs-devel@lists.sourceforge.net" , Jaegeuk Kim , Chao Yu References: <20191108015702.233102-1-damien.lemoal@wdc.com> <20191108015702.233102-9-damien.lemoal@wdc.com> <6a1e0a08-d65c-b075-9bac-23519e9e91c3@acm.org> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAwzDih35LxU2fcWbmhPa7EO2DCv/LM1B10GBB/oQB5kvlq4aA2PSIWkqz4 3SI5kCPSsygD6wKnbRsvNn2mIACva6VHdm62A7xel5dJRfpQjXj2snd1F/YNoNc66UUTABEB AAG0JEJhcnQgVmFuIEFzc2NoZSA8YnZhbmFzc2NoZUBhY20ub3JnPokBOQQTAQIAIwUCVI67 igIbAwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEHFcPTXFzhAJ8QkH/1AdXblKL65M Y1Zk1bYKnkAb4a98LxCPm/pJBilvci6boefwlBDZ2NZuuYWYgyrehMB5H+q+Kq4P0IBbTqTa jTPAANn62A6jwJ0FnCn6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11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Headers-End: 1iTH1G-007jDF-S9 Subject: Re: [f2fs-dev] [dm-devel] [PATCH 8/9] scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 2019-11-08 18:54, Damien Le Moal wrote: > On 2019/11/09 4:06, Bart Van Assche wrote: >> On 11/7/19 5:57 PM, Damien Le Moal wrote: >>> - buf = vzalloc(bufsize); >>> - if (buf) >>> - *buflen = bufsize; >>> + while (bufsize >= SECTOR_SIZE) { >>> + buf = vzalloc(bufsize); >>> + if (buf) { >>> + *buflen = bufsize; >>> + return buf; >>> + } >>> + bufsize >>= 1; >>> + } >> >> Hi Damien, >> >> Has it been considered to pass the __GFP_NORETRY flag to this vzalloc() >> call? > > Do you mean using > > __vmalloc(bufsize, > GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY, PAGE_KERNEL); > > instead of vzalloc() ? (since we cannot pass GFP flags to vzalloc()...) > > Note that this is called with GFP_NOIO set for the caller context in the > case of revalidate zones, and default to GFP_KERNEL for > blkdev_report_zones() unless the caller also tweaks the context memalloc > flags. Hi Damien, Yes, that's what I meant. The following comment from mm/util.c explains why __GFP_RETRY should be used if it is OK for an allocation to fail: /* * We want to attempt a large physically contiguous block first because * it is less likely to fragment multiple larger blocks and therefore * contribute to a long term fragmentation less than vmalloc fallback. * However make sure that larger requests are not too disruptive - no * OOM killer and no allocation failure warnings as we have a fallback. */ Thanks, Bart. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: Re: [dm-devel] [PATCH 8/9] scsi: sd_zbc: Cleanup sd_zbc_alloc_report_buffer() Date: Fri, 8 Nov 2019 19:02:26 -0800 Message-ID: <639eae70-bb57-0c49-0ae9-aed8d33df271@acm.org> References: <20191108015702.233102-1-damien.lemoal@wdc.com> <20191108015702.233102-9-damien.lemoal@wdc.com> <6a1e0a08-d65c-b075-9bac-23519e9e91c3@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Damien Le Moal , "linux-block@vger.kernel.org" , Jens Axboe , "linux-scsi@vger.kernel.org" , "Martin K . Petersen" , "dm-devel@redhat.com" , Mike Snitzer , "linux-f2fs-devel@lists.sourceforge.net" , Jaegeuk Kim , Chao Yu List-Id: dm-devel.ids On 2019-11-08 18:54, Damien Le Moal wrote: > On 2019/11/09 4:06, Bart Van Assche wrote: >> On 11/7/19 5:57 PM, Damien Le Moal wrote: >>> - buf = vzalloc(bufsize); >>> - if (buf) >>> - *buflen = bufsize; >>> + while (bufsize >= SECTOR_SIZE) { >>> + buf = vzalloc(bufsize); >>> + if (buf) { >>> + *buflen = bufsize; >>> + return buf; >>> + } >>> + bufsize >>= 1; >>> + } >> >> Hi Damien, >> >> Has it been considered to pass the __GFP_NORETRY flag to this vzalloc() >> call? > > Do you mean using > > __vmalloc(bufsize, > GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY, PAGE_KERNEL); > > instead of vzalloc() ? (since we cannot pass GFP flags to vzalloc()...) > > Note that this is called with GFP_NOIO set for the caller context in the > case of revalidate zones, and default to GFP_KERNEL for > blkdev_report_zones() unless the caller also tweaks the context memalloc > flags. Hi Damien, Yes, that's what I meant. The following comment from mm/util.c explains why __GFP_RETRY should be used if it is OK for an allocation to fail: /* * We want to attempt a large physically contiguous block first because * it is less likely to fragment multiple larger blocks and therefore * contribute to a long term fragmentation less than vmalloc fallback. * However make sure that larger requests are not too disruptive - no * OOM killer and no allocation failure warnings as we have a fallback. */ Thanks, Bart.