Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1135027pxk; Mon, 31 Aug 2020 10:42:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmxNm9ZiRA6jOq1k8VFGxAMTEwXUQ3OazNcin9qYmy8E2qu9jYGdHVlPJRCVLiowxjJFUO X-Received: by 2002:a17:906:a415:: with SMTP id l21mr72515ejz.431.1598895735932; Mon, 31 Aug 2020 10:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598895735; cv=none; d=google.com; s=arc-20160816; b=dj4AWFPkaqtYJmUWXGI1sse8pE8sDWoALNUXZzlgCMU95lObzS6IJvhoQ3NIvhV95y mO6seJ7ghgteUydJXuPKgb8K6HoJ1AhY1IJD7OaZL8IuuXLHB/+KhVD0niwgeBWfVWhy MnEFC65KsqBjNhe8L9KACulIq8peJhOEG5KDiyWbhY6AC5t8AN5HezdVR2yHCluMoq7i XBcD3/E4V5rgYD7H49h+dVWEyxqZQDRhhcWZnZ8+SpQqI4bl1tIhmFxpGA1jvS0UzXiE cAwTCfzQyPBdNSKqfyOwwC+MOV+m3X1wHs0KyHbkDnlke1r7CwwMdGJiQXZGdIJiu1bU GadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=xpGoi0l5jNBSMWSuTAYdYPLBK/N2oDlGxsWSXueI790=; b=CnB+f1lUnBg1Y6W6E3Q+DnAl/n+LGxhujJtDDatruqC7OEvQQykum0xAb3dvES1ty+ MT3MTgcwqNy4FzpLYiJiMgDd2j0rKLOOrcZlhi692IY5uGs1V8Swu/42qYkkt26nO2qN hps4s0U+OuJ/DZTm0Jcp6W/i7vVhoHbTwOKahps8sM92cQadY3U54Tm8afbsg5fQaPbZ I8CS2lp/2L9bVQhqx/5EbkACboag0pxvG5DZn7HHouIxHfJW1SgBv9Iu53JocilaOtrG adKBeIiIedYEzW7DtAPdgXnirGRk5da7snymAVNn9ZyRguXnYkxJA9djTm8A06ylRX/4 Solw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si2647331edw.573.2020.08.31.10.41.52; Mon, 31 Aug 2020 10:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgHaRjZ (ORCPT + 99 others); Mon, 31 Aug 2020 13:39:25 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:33976 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbgHaRjW (ORCPT ); Mon, 31 Aug 2020 13:39:22 -0400 Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 1A9151B44DF; Tue, 1 Sep 2020 02:39:21 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 07VHdJa6366555 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 1 Sep 2020 02:39:20 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-20) with ESMTPS id 07VHdJ753466384 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 1 Sep 2020 02:39:19 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id 07VHdIdG3466383; Tue, 1 Sep 2020 02:39:18 +0900 From: OGAWA Hirofumi To: Jens Axboe Cc: Matthew Wilcox , Andrew Morton , linux-kernel , fsdevel Subject: Re: [PATCH] fat: Avoid oops when bdi->io_pages==0 References: <87ft85osn6.fsf@mail.parknet.co.jp> <87o8mq6aao.fsf@mail.parknet.co.jp> <4010690f-20ad-f7ba-b595-2e07b0fa2d94@kernel.dk> <20200831165659.GH14765@casper.infradead.org> <33eb2820-894e-a42f-61a5-c25bc52345d5@kernel.dk> Date: Tue, 01 Sep 2020 02:39:18 +0900 In-Reply-To: <33eb2820-894e-a42f-61a5-c25bc52345d5@kernel.dk> (Jens Axboe's message of "Mon, 31 Aug 2020 11:00:14 -0600") Message-ID: <87d03667g9.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jens Axboe writes: > On 8/31/20 10:56 AM, Matthew Wilcox wrote: >> On Mon, Aug 31, 2020 at 10:39:26AM -0600, Jens Axboe wrote: >>> We really should ensure that ->io_pages is always set, imho, instead of >>> having to work-around it in other spots. >> >> Interestingly, there are only three places in the entire kernel which >> _use_ bdi->io_pages. FAT, Verity and the pagecache readahead code. >> >> Verity: >> unsigned long num_ra_pages = >> min_t(unsigned long, num_blocks_to_hash - i, >> inode->i_sb->s_bdi->io_pages); >> >> FAT: >> if (ra_pages > sb->s_bdi->io_pages) >> ra_pages = rounddown(ra_pages, sb->s_bdi->io_pages); >> >> Pagecache: >> max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages); >> and >> if (req_size > max_pages && bdi->io_pages > max_pages) >> max_pages = min(req_size, bdi->io_pages); >> >> The funny thing is that all three are using it differently. Verity is >> taking io_pages to be the maximum amount to readahead. FAT is using >> it as the unit of readahead (round down to the previous multiple) and >> the pagecache uses it to limit reads that exceed the current per-file >> readahead limit (but allows per-file readahead to exceed io_pages, >> in which case it has no effect). >> >> So how should it be used? My inclination is to say that the pagecache >> is right, by virtue of being the most-used. > > When I added ->io_pages, it was for the page cache use case. The others > grew after that... FAT and pagecache usage would be similar or same purpose. The both is using io_pages as optimal IO size. In pagecache case, it uses io_pages if one request size is exceeding io_pages. In FAT case, there is perfect knowledge about future/total request size. So FAT divides request by io_pages, and adjust ra_pages with knowledge. I don't know about verity. Thanks. -- OGAWA Hirofumi