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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6361CC43334 for ; Mon, 13 Jun 2022 06:56:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC62B6B024D; Mon, 13 Jun 2022 02:56:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B75D76B024E; Mon, 13 Jun 2022 02:56:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EF736B024F; Mon, 13 Jun 2022 02:56:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8C4DB6B024D for ; Mon, 13 Jun 2022 02:56:39 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4E6D133C8C for ; Mon, 13 Jun 2022 06:56:39 +0000 (UTC) X-FDA: 79572304518.15.2961EF4 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf26.hostedemail.com (Postfix) with ESMTP id A46EB140091 for ; Mon, 13 Jun 2022 06:56:38 +0000 (UTC) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25D5DFNr037410; Mon, 13 Jun 2022 06:56:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=sg4r/3HlNtUZCzfEQKxVVhzIMzc01uTkxBUOjFJpuKA=; b=NTLr3Rw9NouBrw7ClKulUEjebkO6A5itEqempmqPPPMIe5WxzTU1RSeuSNqgfcQn+Qel mpyWvvRoLkX7BBylqpkYunkyAsl/lIGSSHiWYnubBtx0gSiorItaeUnSnErhVKh1TYVb G6DM9VtcvymwPUdxADeoOwB370fMvCzk3ag/yA/bfNUIAGHLBm5gy/BIuEuLSd+rfBFo ScYM+CzYJZsSDOfTyT1jJMuHuhBoFfgAdXkwemiKCqxo5iqi4dpnLscBe+et+zL7PfDK I9Adon6TD+u/6m2HYQfxfvzeSbDXAYku8Dd0+d8W7hGVcYHuGVi7UIhMuQ6Gzx7IjLiC uQ== Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gn53qhkpg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 06:56:29 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25D6oulj030905; Mon, 13 Jun 2022 06:56:28 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 3gmjp8srqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 06:56:28 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25D6uOd822544728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jun 2022 06:56:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB10811C052; Mon, 13 Jun 2022 06:56:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FC3B11C050; Mon, 13 Jun 2022 06:56:24 +0000 (GMT) Received: from localhost.localdomain (unknown [9.171.48.106]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 13 Jun 2022 06:56:24 +0000 (GMT) Date: Mon, 13 Jun 2022 08:56:22 +0200 From: Sumanth Korikkar To: Matthew Wilcox Cc: linux-ext4@vger.kernel.org, gerald.schaefer@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nilfs@vger.kernel.org Subject: Re: [PATCH 06/10] hugetlbfs: Convert remove_inode_hugepages() to use filemap_get_folios() Message-ID: References: <20220605193854.2371230-7-willy@infradead.org> <20220610155205.3111213-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: avIoxhTFiSlJjY2R9CmSKMJMnKj8Jgxi X-Proofpoint-ORIG-GUID: avIoxhTFiSlJjY2R9CmSKMJMnKj8Jgxi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-13_02,2022-06-09_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=774 lowpriorityscore=0 suspectscore=0 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206130029 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655103399; a=rsa-sha256; cv=none; b=4Q7aW43fdQbLQhbbs5XyiRAbZpo54JUveam46VkqSHrM5WsJLC//YsHlRGPVRyZX90YVBx O+xhDZ7Aw/8whDE1Wm6qZEVmrEhNEDGwpk8dwIRJDMycBhL/mM0cVNB4eUxpdAzW3FcNAO 3bTiIvxULfrk075jVkTO3mOEhOvYvTc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=NTLr3Rw9; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655103399; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sg4r/3HlNtUZCzfEQKxVVhzIMzc01uTkxBUOjFJpuKA=; b=nOabb6wytgek0uY9u4RVFCaUvf9yhPXe3PL7aEoB5yfh1gPdptbTFDrsemkcd2ForuTdh3 VlNNOdrDXYj74ocLupIATsO8lP1oeElRdwbGUQmyiOLgcP7sKf3FMIqGyhNw4rKD5sYC/N 9v9ykAMuHmEexH4wzWtoYs9XEa0gbzg= X-Rspamd-Queue-Id: A46EB140091 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=NTLr3Rw9; spf=pass (imf26.hostedemail.com: domain of sumanthk@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=sumanthk@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: 9gkceza5tjmyaex5ip5a9nb587ac8n3o X-HE-Tag: 1655103398-461608 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 Fri, Jun 10, 2022 at 10:17:36PM +0100, Matthew Wilcox wrote: > On Fri, Jun 10, 2022 at 05:52:05PM +0200, Sumanth Korikkar wrote: > > To reproduce: > > * clone libhugetlbfs: > > * Execute, PATH=$PATH:"obj64/" LD_LIBRARY_PATH=../obj64/ alloc-instantiate-race shared > > ... it's a lot harder to set up hugetlb than that ... > > anyway, i figured it out without being able to run the reproducer. > > Can you try this? > > diff --git a/mm/filemap.c b/mm/filemap.c > index a30587f2e598..8ef861297ffb 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2160,7 +2160,11 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, > if (xa_is_value(folio)) > continue; > if (!folio_batch_add(fbatch, folio)) { > - *start = folio->index + folio_nr_pages(folio); > + unsigned long nr = folio_nr_pages(folio); > + > + if (folio_test_hugetlb(folio)) > + nr = 1; > + *start = folio->index + nr; > goto out; > } > } Yes, With the patch, The above tests works fine. -- Thanks, Sumanth