Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4097928ybv; Tue, 25 Feb 2020 13:09:37 -0800 (PST) X-Google-Smtp-Source: APXvYqy8hzT5YueyfCM8qXXYzFrBBojRiwwGGEdk4DDH6yiSmee4u3pJUhymZyNI51K/6pkHUbkQ X-Received: by 2002:a05:6830:147:: with SMTP id j7mr421064otp.12.1582664976787; Tue, 25 Feb 2020 13:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582664976; cv=none; d=google.com; s=arc-20160816; b=wB7iy9/r92ZAILuxhaL6WRqTcWJQz3hnPVgxjsVq3ABQZ1MAGG18RHwcuBpZ/fNiDa fyvRT48OvWAF3eQ9Xh0NbwJK79JTm9YXop9BEVQPh7yWAlher9Er4aVv85UUfq0hd2ig wAs5FvEbvRHXh3I0u4TJc2HoqqfIx8ddop6dgFI7yvcI3tcfJLfz9pzhhZeQV7idsdNw Q4ItZrm4+wywqSq0Pww0Be3mtzQpXUzSltViAjL00j9Pdl+dZwYuASkLLHOtmB2yN7BO UqCSEc5YEKI7B+I3RsJT6++I72QL5awXxvcjYIuOgcGQZGQ7s/pWmtW9lRcHAEgFLOSz FbtA== 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:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=f38t1vB1E09D3O7biTt/uQi42QKpJWaCNeM//jWgarM=; b=jViXgEf/WF29ErPbN5flo4XbNPSQiU+5p+s67WgzYOmpDamohmsd1vOmz0oTR1Ncci EdTvLOPtZGruOvzWU7383qnTMsEIUzvLNsn4Qoj7t6ri/6o9fFW2WsUpvNaX3lPMkp4v Q8kyXncdb2e1npS4hA/trA1A6iqh7TsdNAO3+ozSEeMVWcDC5XnNec4xNWmBdcIAPUcZ 93V7UQMhp46uxaG88KJ8zDmy9wPvJkDBJCXbLkwQBwoM2woL3aOsLYDumyJXe1PaK5AT nRTqAZkRGL03NBG7fm8SnuFxgPAnj/C0PHcEG+KAQmhPnPnFZyTBekATmDy121+QUV2M 1IOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sjvb63g0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h128si154763oif.258.2020.02.25.13.09.22; Tue, 25 Feb 2020 13:09:36 -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=@google.com header.s=20161025 header.b=sjvb63g0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731764AbgBYUbb (ORCPT + 99 others); Tue, 25 Feb 2020 15:31:31 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40768 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731725AbgBYUbb (ORCPT ); Tue, 25 Feb 2020 15:31:31 -0500 Received: by mail-pl1-f195.google.com with SMTP id y1so277757plp.7 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=tK/8DdIpS84B1/zG57xc+XujOatDxffkCjZTm13gkbLVTDVtTU8hflUrgvQMTEKnXk ZhFEKupuihhk3KyHmcsfEqm2JOvGEhCjl0FnxMQzt7+sJjGRZz3S+g0R7b31ToI8GTiS SY4u2TGtoDe+SVANvMwX2mjxEXhCv5RJhb4i6Sz6uuMSCeaEMErkvogzf77KFWAgyyz2 DDl2g121uTrcAoVp2R5hDZy3OyITlmwCPJRSibmxqU2TVxl9GLWcLW/1w3aGyh9mLSZa 0hgbx+nEEGxzaIAfOmTS3egEhiiHlSVFSgHAS6PN7TMricMVMv3ZsrzTbXLEoBB9Q6m/ +5Vg== X-Gm-Message-State: APjAAAV1GB7N8Jo1VPnWUmkAIQJvEjT3sPscp+q3DcvTQMuTZ3m4mT0R 73Hhxys3Fu8eCicck75eb7pIUg== 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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