Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp202034ybx; Mon, 4 Nov 2019 18:41:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxV0pdr3rpCaI1h6xtnnVfIc4YH2BOtHT67v/76aEvXX+yViHMNVOuU7l688QvKw7RS06a6 X-Received: by 2002:a50:9b43:: with SMTP id a3mr33235551edj.73.1572921694196; Mon, 04 Nov 2019 18:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572921694; cv=none; d=google.com; s=arc-20160816; b=NW0NEwbFxSKE6PXBqLSwKfZj+zArN0CeozcvclQGJMookJ0Qw4IAlUEeeXcIYe3hBu PR6IPdfraSrsjEPQJO4/WYQOaCzv1smT1fFGIe8U9UBkYEM69HARYvtlnIfVys2L8BSU pX2g326fIkN5si/528l/A7RRbhr5Pi9gzDUpzWDLSjTEtPuyszZ+ZC0sGqJR8JKE7R3u nnPZBAQucbPDLYdlw3i7m1b3UfUhtJQYhMw9/W4qnvtQ192wOan+V6s7lNuIPtDTlDPT zuZS6ut7+wRn1D2rg02euN9ubYluoHvxRSya3Y6hmGxIBs35szqC6K5y7WCQPVk4Y6+4 GDLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=IeloNK7GdkjVhqko4X31kdk2ctProezbgaImEviBcuA=; b=t8gFoePoh2cpcV2YBK4l/kROGsHI3RGPOP9nPrSdJnC5hmUGiQTOSM71mAteS1wCif zh759TfwifuaV4ZREpieCQdC8ru+KqD9bmJG8D9a5q2QGx25gdDhw72P0uNvkAF++QVa QZdFcpElU7ZytZ3417jZpoErJmbuTOmV0+y87l5h41gctd+ucbjMJsEzQyTdbUxDM0jR dLtlO4RzTKSQIn9jzdAIV3Z3zkEtah4fcNGadK9JnJh+seFX5YNKpHO0+9laYXCLJQWL w4fvtLe401hWnctKzBa95wak6uYm25mztYHnY30P9MWR0i0ZJ842UWDkuvxsXnQOOJa7 hJMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DhOIaSgg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20si10203840ejb.302.2019.11.04.18.41.11; Mon, 04 Nov 2019 18:41:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DhOIaSgg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729959AbfKECih (ORCPT + 99 others); Mon, 4 Nov 2019 21:38:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:56144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729717AbfKECih (ORCPT ); Mon, 4 Nov 2019 21:38:37 -0500 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3C33214D8; Tue, 5 Nov 2019 02:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572921516; bh=AO5GUw4uAQW7SjlfIGhGgEAuiI6q1O8trlvLX3b/MnE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DhOIaSgg4PyeAcIv/11SHw83YohNkY+3PEl9C++E070AEg22bhyJOvAFZbG46GpDK Uz5ET1GLWnqSqOuiYrmnlCqUp6q+Bw40PITQWHqOjqYNWAMJ9sWU/4r07RWwIv8W0m 0LIkohafg+2shuXJOSTN+UAjbuzhYtQFj6tBOxg8= Date: Mon, 4 Nov 2019 18:38:35 -0800 From: Eric Biggers To: Chao Yu Cc: Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH 3/3] Revert "f2fs: use kvmalloc, if kmalloc is failed" Message-ID: <20191105023835.GD692@sol.localdomain> Mail-Followup-To: Chao Yu , Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20191101095324.9902-1-yuchao0@huawei.com> <20191101095324.9902-3-yuchao0@huawei.com> <20191105000249.GA46956@jaegeuk-macbookpro.roam.corp.google.com> <40d0df3f-cc55-d31a-474b-76f57d96bd89@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40d0df3f-cc55-d31a-474b-76f57d96bd89@huawei.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 05, 2019 at 10:17:41AM +0800, Chao Yu wrote: > On 2019/11/5 8:02, Jaegeuk Kim wrote: > > On 11/01, Chao Yu wrote: > >> This reverts commit 5222595d093ebe80329d38d255d14316257afb3e. > >> > >> As discussed with Eric, as kvmalloc() will try kmalloc() first, so > >> when we need allocate large size memory, it'd better to use > >> f2fs_kvmalloc() directly rather than adding additional fallback > >> logic to call kvmalloc() after we failed in f2fs_kmalloc(). > >> > >> In order to avoid allocation failure described in original commit, > >> I change to use f2fs_kvmalloc() for .free_nid_bitmap bitmap memory. > > > > Is there any problem in the previous flow? > > No existing problem, however, it's redundant to introduce fallback flow in > f2fs_kmalloc() like vmalloc() did, since we can call f2fs_vmalloc() directly in > places where we need large memory. > > Thanks, > f2fs_kmalloc() also violated the naming convention used everywhere else in the kernel since it could return both kmalloc and vmalloc memory, not just kmalloc memory. That's really error-prone since people would naturally assume it's safe to free the *_kmalloc()-ed memory with kfree(). - Eric