Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp329757rwb; Wed, 16 Nov 2022 00:58:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf70Hoc7Su3wGBqmsntrRGnILQxRtNdTlrd81qTeOcLUQ9cHBNO0yTAdl13OCJHJz7Vgf9aa X-Received: by 2002:a17:902:6a8c:b0:188:6c5b:ffb0 with SMTP id n12-20020a1709026a8c00b001886c5bffb0mr8064661plk.125.1668589096610; Wed, 16 Nov 2022 00:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668589096; cv=none; d=google.com; s=arc-20160816; b=foUvisaPbbnzLu7rmRGhuNrN79g4AlXH53SHzLnq+jjq4+ujXSO/O7z5Nw/FTIWi3J n8wPjhTkVJ9lKrZb0J88wVtGv7z36ryBqnzyaWkv2fPYNKzrXzLtbT/0oJAh8WrkCqET L153KABsaCDq/DAV01ypK/HfYmsbq8z6DTAgnmWlC19SovOqcnENJ/VCOOd660DD2wBL vZRs/WaWRQsTBihfDwNHK5p7UxUw00SvuWRNa12f15s//uAIhdQ+/sHB/993MGNLa7bT Q+l5IXkHutI8XHHXjsZHIL5aleI7bj/uI66/k2bGD/Lsj5ABeNy9ykYZm1Eh+jTjOr+N PwrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:subject:from:references:cc:to:content-language :user-agent:mime-version:date:message-id; bh=m4tyozNwbKGkD+GenU8Lt0j0EmryWtydiqVJ4c3LhEY=; b=JVR8g33hifrFw5BJ/W3mRky3jRfgIjNVLyqNo5fPm02X1eW8aOMDYGQRkdLuTIsshx qB4ZELiMhHAhJHbqAzCBsdbT22cmjf4t59GB6qtPj/5pke0bQpHYUEijE3Jm2TcQnhpl DhtLnQXwj5OPpDNEoHGx1XWni7YhcTEx4gUqfiwwjXGNccw8L3+OhynTH62FxT4H3tjA xGxKCeMV58goIro9wMLOXe8IvrL07c7tQ/zoNGFSghoFesAiu9podtAQW35tmQOmHKy0 MzvWk0RmI4kdn+t6wnMDEdHKvTsb5UV4m/CKGo3psQCzjRmecZ3K2Scm6XZlZ9C+6fb9 1bgA== 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=gmx.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my11-20020a17090b4c8b00b002182059ec60si1608669pjb.80.2022.11.16.00.58.05; Wed, 16 Nov 2022 00:58:16 -0800 (PST) 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=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232760AbiKPIoX (ORCPT + 90 others); Wed, 16 Nov 2022 03:44:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237882AbiKPIoU (ORCPT ); Wed, 16 Nov 2022 03:44:20 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EB3F18E20; Wed, 16 Nov 2022 00:44:18 -0800 (PST) Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MO9z7-1obnSn1Yin-00OZhV; Wed, 16 Nov 2022 09:43:57 +0100 Message-ID: <3918175e-dddd-2a55-32c4-c07de78ff4cb@gmx.com> Date: Wed, 16 Nov 2022 16:43:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US To: ChenXiaoSong , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, zhangxiaoxu5@huawei.com, yanaijie@huawei.com, wqu@suse.com References: <20221115171709.3774614-1-chenxiaosong2@huawei.com> <20221115171709.3774614-2-chenxiaosong2@huawei.com> <9b47b291-b1a0-ac0c-2049-b7de6545c26b@gmx.com> From: Qu Wenruo Subject: Re: [PATCH v4 1/3] btrfs: add might_sleep() to some places in update_qgroup_limit_item() In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:ygu7CYbFO6+vdJjE1V6fAgvNgZJssK4orDu/r87w4bh0tG16AxM ahoBvFF4VuMRJ8UMpqOgbuTnkXwgHggYdMlgquDddBvhd+a2y/SzFRt2WNjTT4eWjXVqhX6 rHDAYmFeiNwvIxhjsWmWA8GJLVcdJYq0rf28ASeNVJ4vz8eTVjOeEjHIFll38z685hK6Kao Cld5i47eca/ilYOZkrIDg== UI-OutboundReport: notjunk:1;M01:P0:yl5IKU26nSk=;t2ZS1JTZvg0o8wbVvP7cFuAUDHT CsrVKfIUpOWeFl9RJ5pGWgW39EbW4r0E1EIKZBSiyXz7Or67USf98662KuRoDGuJBg+hEC8y7 PO29D238btctRcKQjRbFhvwme6xBsuToH30a80VRQQMnFh+Ua2noBEZuBy3J5NPFUmVee57vk D3OlD2R3CtrhLwPtX4V7q65+5wyV7m42KMvzizZKPlt+nBQN1HDQuO8MCzJ53bvX2s0bQHjvI FN5jReq0VeZXTd8e0KPGkR6wnvrtQxwyVvTHPgdGLmCbYyYqNGrYi3JziyocgHQAeAgA8cDSJ gcWEcfKKhAbvDCWEnzw+Jq/MhEiqR/ghr1wOUBwYD/sG2sgyfQnQHBT4pll5QTqrTH9+GyHe2 5evYrRFfFiqQ1rPO4d+ZwKdxegKz8vNUTVP8kiW3RwEV5MfYwWCOtUMhtP1/BR7qZZ8BhMksE 6k4zdi7DQL3GW+wqsY4KlkHdknjG4hhfDQEIiioxtQKVdpo4tqoBRW24SDX+A2vCHm4VNwa6b K2kFFeKRLxG+KY+ADNmQyzT11E8bcxQr3tcxlHhZOtZkBo48uO7Qkf4iSHZmIPqnn7/P84yC2 X/2YOpOYyLYIczNyh24MmaAcaxwIzlxBxW/dBZBlcYTNDFtGdgkjfv9apIxVRSDMAwHUDwJ7X 6ZIhlKNWHmSIkrzLd3J32dYiEupBW/YivgZOA7FY4PXKGkSNGveqQxcZCeDDZmV23Yk50KpjZ pXHHukRlK1UO2IAIYySnSUEk9sSGZGR2gJ0kmd38/dfdd7rluwWCEdkJPE+bBvIl80oj/e6H2 Xwb1FLnYOmNfX7D7ZVFoCy6dE1zgfmetBneZcwcvrdJ5Ds9WFsJbsGFvA3MrTp/4SIRsbdk7m IxKPTu4V4wwAM10uuP5gikyDLdNy1QhTummJE43zIcDueTJDPpL8jBosp+CT7Wd/pBFCB3RdV f1p2OIZJLd733YqMpYznQ/Ukboo= X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS 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 2022/11/16 16:09, ChenXiaoSong wrote: > 在 2022/11/16 6:48, Qu Wenruo 写道: >> Looks good. >> >> We may want to add more in other locations, but this is really a good >> start. >> >> Reviewed-by: Qu Wenruo >> >> Thanks, >> Qu > > If I just add might_sleep() in btrfs_alloc_path() and > btrfs_search_slot(), is it reasonable? Adding it to btrfs_search_slot() is definitely correct. But why for btrfs_alloc_path()? Wouldn't kmem_cache_zalloc() itself already do the might_sleep_if() somewhere? I just looked the call chain, and indeed it is doing the check already: btrfs_alloc_path() |- kmem_cache_zalloc() |- kmem_cache_alloc() |- __kmem_cache_alloc_lru() |- slab_alloc() |- slab_alloc_node() |- slab_pre_alloc_hook() |- might_alloc() |- might_sleep_if() Thanks, Qu > > Or just add might_sleep() to one place in update_qgroup_limit_item() ?