From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC08714A630 for ; Thu, 19 Dec 2024 07:30:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734593423; cv=none; b=pru2eEv9DZrlYPUxyF/wlU/+xC3t3Wn5tSOg6exwncgOaN8Es0Wk87P9D3W0bag9LxWeAcM58nglENGX+/G2VzZWAxwaG83B9Oa3l9WqoURjQUxNkkLKfrcM+qlpYKMZ5LEAZ2Zt1gr/xta89QYtI25hcWYcf3BK8sRq3ewPqtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734593423; c=relaxed/simple; bh=OWuBDDKLn1JbzN9aIGe62lrwWEc+MZ9C7OD/6QIWRBg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C+DEGp976g8Gjbo4OfhfxS58nPvGiAKkufJVJPXKbYXmGePKiQ/+eKnDdlHzMWZdoEYzWWnhXYiSPWOTkc8+K6TVqEYg0XrAbhb5lBhask9mNycl2yNMTEfS2Ihv3YKOS/NYFgCjyLeEqLLaws20XgIem0tPZrDhI37o3DnIwak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=W8m56nom; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="W8m56nom" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1734593417; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=dA/uo5tghpmaqVajoyvSrLkgzd8pWgdsOMRxw06MACI=; b=W8m56nomp4GWo+14Qcl+V8oERLnk5pZoDre+kmDeTsDq6e0vHDVRp5hwoca9koj/amiCzHEcHTilpQenN6K6cxAT/4YPCY8CKN0ivQo3GbLd3YDsTvVTP41lCbgoR1nGFNDUBUnCbtQyeSxdUWncZQCj4t0AAaOU/Ew+f5fM2D4= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WLpQrub_1734593416 cluster:ay36) by smtp.aliyun-inc.com; Thu, 19 Dec 2024 15:30:16 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: david@redhat.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm: shmem: fix the update of 'shmem_falloc->nr_unswapped' Date: Thu, 19 Dec 2024 15:30:09 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 In-Reply-To: <77d8ef76a7d3d646e9225e9af88a76549a68aab1.1734593154.git.baolin.wang@linux.alibaba.com> References: <77d8ef76a7d3d646e9225e9af88a76549a68aab1.1734593154.git.baolin.wang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The 'shmem_falloc->nr_unswapped' is used to record how many writepage refused to swap out because fallocate() is allocating, but after shmem supports large folio swap out, the update of 'shmem_falloc->nr_unswapped' does not use the correct number of pages in the large folio, which may lead to fallocate() not exiting as soon as possible. Anyway, this is found through code inspection, and I am not sure whether it would actually cause serious issues. Fixes: 809bc86517cc ("mm: shmem: support large folio swap out") Signed-off-by: Baolin Wang --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index dec659e84562..ac58d4fb2e6f 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1535,7 +1535,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) !shmem_falloc->waitq && index >= shmem_falloc->start && index < shmem_falloc->next) - shmem_falloc->nr_unswapped++; + shmem_falloc->nr_unswapped += nr_pages; else shmem_falloc = NULL; spin_unlock(&inode->i_lock); -- 2.39.3