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=-5.3 required=3.0 tests=BAYES_00, 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 C82ACC47E4B for ; Thu, 15 Jul 2021 11:44:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8295D613BA for ; Thu, 15 Jul 2021 11:44:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8295D613BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8B0E98D00B2; Thu, 15 Jul 2021 07:44:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 863398D0065; Thu, 15 Jul 2021 07:44:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 728C38D00B2; Thu, 15 Jul 2021 07:44:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 4B7038D0065 for ; Thu, 15 Jul 2021 07:44:31 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3286820BDD for ; Thu, 15 Jul 2021 11:44:30 +0000 (UTC) X-FDA: 78364639500.34.A3F7780 Received: from outbound-smtp27.blacknight.com (outbound-smtp27.blacknight.com [81.17.249.195]) by imf21.hostedemail.com (Postfix) with ESMTP id 26DCBD0070E8 for ; Thu, 15 Jul 2021 11:44:28 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp27.blacknight.com (Postfix) with ESMTPS id 3521BCAE54 for ; Thu, 15 Jul 2021 12:44:26 +0100 (IST) Received: (qmail 5069 invoked from network); 15 Jul 2021 11:44:25 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.255]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 15 Jul 2021 11:44:25 -0000 Date: Thu, 15 Jul 2021 12:44:24 +0100 From: Mel Gorman To: yong w Cc: wuzhouhui , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, nico@fluxnic.net, wang.yong12@zte.com.cn Subject: Re: Re: [BUG] ramfs system panic when using dd to create files Message-ID: <20210715114424.GR3809@techsingularity.net> References: <7074179d.c3fd.17aa3f148cc.Coremail.wuzhouhui14@mails.ucas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.195 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Stat-Signature: fbxrbsur8g5661ucktzsdyamt563rtxk X-Rspamd-Queue-Id: 26DCBD0070E8 X-Rspamd-Server: rspam01 X-HE-Tag: 1626349468-117087 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jul 14, 2021 at 10:30:22PM +0800, yong w wrote: > Thanks for your reply! > > > Limit max size of ramfs. > It's no use using size to limit the size of ramfs. > "mount -t ramfs -o size=10M ramfs /ramfs" is the command i use. > ramfs does not support size= limiting, that's what tmpfs is for. > > > > The comments already explains why kernel should panic on this situation: > > /* > > * If we got here due to an actual allocation at the > > * system level, we cannot survive this and will enter > > * an endless loop in the allocator. Bail out now. > > */ > > But it causes panic, actually , I don't want it panics Then use tmpfs and specify size=. It's mentioned in filesystems/tmpfs.rst --8<-- If you compare it to ramfs (which was the template to create tmpfs) you gain swapping and limit checking. Another similar thing is the RAM disk (/dev/ram*), which simulates a fixed size hard disk in physical RAM, where you have to create an ordinary filesystem on top. Ramdisks cannot swap and you do not have the possibility to resize them. --8<-- -- Mel Gorman SUSE Labs