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=-9.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL 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 7BA37C35E04 for ; Tue, 25 Feb 2020 20:31:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3C59021927 for ; Tue, 25 Feb 2020 20:31:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sjvb63g0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C59021927 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CCF466B0003; Tue, 25 Feb 2020 15:31:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CAE466B0005; Tue, 25 Feb 2020 15:31:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBA8E6B0006; Tue, 25 Feb 2020 15:31:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id A550A6B0003 for ; Tue, 25 Feb 2020 15:31:32 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5488E3AA3 for ; Tue, 25 Feb 2020 20:31:32 +0000 (UTC) X-FDA: 76529794824.14.coast29_64ac30217270c X-HE-Tag: coast29_64ac30217270c X-Filterd-Recvd-Size: 5314 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Feb 2020 20:31:31 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id e9so225158pjr.4 for ; Tue, 25 Feb 2020 12:31:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=f38t1vB1E09D3O7biTt/uQi42QKpJWaCNeM//jWgarM=; b=sjvb63g0ui81MI1fbKV7N4ZZhCK7dzBk+hc23Dx3DUZXkjdV7ixE6DbDIL3m++COvZ exMZqZqLJm4kkM77tkSO9TmOUxFgYUNtzeqItuQQ/uN8LBrAByURzxuTL6l+vSiRxQDV vWQIXWSSLjiZ95LDxy/SlsPwrIa+6E+3JBgvZRMUMUT0Zcd6LqPy3lX2vcrtS99LMSpL C3dmmZ2E/ABD5Ie2tbJGR/CRO1y7VnwD7/+QCfS2kyN+MEbVbX94JnlZUCUpPJ/+vjIo r1buECakC2UYaBHVQW3v/s5+Kibf0uEuGG16hgY53a65cKvyadxR4creiDaMj9x/TiOz fKSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=f38t1vB1E09D3O7biTt/uQi42QKpJWaCNeM//jWgarM=; b=EuKEUUcvA3NzlUTShXerlzFpH9GOhBSE3qrcnPLV3jS9QMsuekOOdeJY0FdVcUVBd8 65hTGPVL5FOH30hmqKdF+iFTSDY2iyPB2x4QXX5dtIyh+xRUM3bD0Ac/lgp6atSXRs4f YDYr/SnVOxHbFXNnYRf4b1Zv1pZ9G9by+dniO78GNYk9KRY8HZfsHTlwQPgUttwf1FPf mbvVpdrLfe89uo/oS5OS+bg7ONIbumJuJm9cl4Mv1SuaqJ66vq5tudxyCbpC8BtgQe7n QWb0tF2Q+WK6KYaz2lfyml9vQQNBSPm+d6OEvSg80d8iTqNzmXsGMj9dR1h7Lj2v49lm kkvQ== X-Gm-Message-State: APjAAAXfw7LUrfFIBe/HoZQIBIMsny1trt+TliBNyljDORki9gmZ2kE1 OfQdo8Yz6vjKxQ3HW9Jt/y3gJw== X-Google-Smtp-Source: APXvYqyDeg5oZCf2F73phX2nvXcxMbTP9CUH6FGv8O9YLT3d4xw7nlHTf/BPkYJf899KEhhCWK3kng== X-Received: by 2002:a17:902:8604:: with SMTP id f4mr327049plo.278.1582662690368; Tue, 25 Feb 2020 12:31:30 -0800 (PST) Received: from [100.112.92.218] ([104.133.9.106]) by smtp.gmail.com with ESMTPSA id w81sm18529544pff.95.2020.02.25.12.31.29 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Feb 2020 12:31:29 -0800 (PST) Date: Tue, 25 Feb 2020 12:31:07 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: David Hildenbrand cc: Hugh Dickins , Yang Shi , kirill.shutemov@linux.intel.com, aarcange@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] mm: shmem: allow split THP when truncating THP partially In-Reply-To: <14abd659-1571-8196-202d-d2fcc227a4b0@redhat.com> Message-ID: References: <1575420174-19171-1-git-send-email-yang.shi@linux.alibaba.com> <00f0bb7d-3c25-a65f-ea94-3e2de8e9bcdd@linux.alibaba.com> <14abd659-1571-8196-202d-d2fcc227a4b0@redhat.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Tue, 25 Feb 2020, David Hildenbrand wrote: > > > > I notice that this thread has veered off into QEMU ballooning > > territory: which may indeed be important, but there's nothing at all > > that I can contribute on that. I certainly do not want to slow down > > anything important, but remain convinced that the correct filesystem > > implementation for punching a hole is to punch a hole. > > I am not completely sure I follow all the shmem details (sorry!). But > trying to "punch a partial hole punch" into a hugetlbfs page will result > in the very same behavior as with shmem as of now, no? I believe so. > > FALLOC_FL_PUNCH_HOLE: "Within the specified range, partial filesystem > blocks are zeroed, and whole filesystem blocks are removed from the > file." ... After a successful call, subsequent reads from this range > will return zeros." > > So, as long as we are talking about partial blocks the documented > behavior seems to be to only zero the memory. > > Does this patch fix "FALLOC_FL_PUNCH_HOLE does not free blocks if called > in block granularity on shmem" (which would be a valid fix), Yes. The block size of tmpfs is (talking x86_64 for simplicity) 4KiB; but when mounted huge, it transparently takes advantage of 2MiB extents when it can. Rather like a disk-based filesystem always presenting a 4KiB block interface, but stored on disk in multisector extents. Whereas hugetlbfs is a different filesystem, which is and always has been limited to supporting only certain larger block sizes. > or does it > try to implement something that is not documented? (removing partial > blocks when called in sub-block granularity) No. > > I assume the latter, in which case I would interpret "punching a hole is > to punch a hole" as "punching sub-blocks will not free blocks". > > (if somebody could enlighten me which important piece I am missing or > messing up, that would be great :) ) > > -- > Thanks, > > David / dhildenb