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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579DAC636CC for ; Fri, 17 Feb 2023 02:12:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229953AbjBQCM3 (ORCPT ); Thu, 16 Feb 2023 21:12:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjBQCM3 (ORCPT ); Thu, 16 Feb 2023 21:12:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D3033B856; Thu, 16 Feb 2023 18:12:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07B406123D; Fri, 17 Feb 2023 02:12:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53654C4339B; Fri, 17 Feb 2023 02:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1676599947; bh=xJKhC3IDqhyWV/NDvL4zoWgraVILgyFZbv5mjWHunuE=; h=Date:To:From:Subject:From; b=UUiJ4QqwN4gdBQOpbbEbBeKgvSq4EsXSfnuLqiRXDQa/vFDt7D+zetzZ3X8JdatyY Bn+voMlXG6GAgW1dJewSkYerVgkwehm7xU5zGGJ+mx8IJOeI2kM+Pl7FWAysxNCiuD 8Sr2sEJJ+1aaogPyWXA2P4Z2Mw4MBEYfL6FmfUjI= Date: Thu, 16 Feb 2023 18:12:26 -0800 To: mm-commits@vger.kernel.org, stable@vger.kernel.org, shy828301@gmail.com, hughd@google.com, zokeefe@google.com, akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-hotfixes-stable] mm-madv_collapse-set-eagain-on-unexpected-page-refcount.patch removed from -mm tree Message-Id: <20230217021227.53654C4339B@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount has been removed from the -mm tree. Its filename was mm-madv_collapse-set-eagain-on-unexpected-page-refcount.patch This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: "Zach O'Keefe" Subject: mm/MADV_COLLAPSE: set EAGAIN on unexpected page refcount Date: Tue, 24 Jan 2023 17:57:37 -0800 During collapse, in a few places we check to see if a given small page has any unaccounted references. If the refcount on the page doesn't match our expectations, it must be there is an unknown user concurrently interested in the page, and so it's not safe to move the contents elsewhere. However, the unaccounted pins are likely an ephemeral state. In this situation, MADV_COLLAPSE returns -EINVAL when it should return -EAGAIN. This could cause userspace to conclude that the syscall failed, when it in fact could succeed by retrying. Link: https://lkml.kernel.org/r/20230125015738.912924-1-zokeefe@google.com Fixes: 7d8faaf15545 ("mm/madvise: introduce MADV_COLLAPSE sync hugepage collapse") Signed-off-by: Zach O'Keefe Reported-by: Hugh Dickins Acked-by: Hugh Dickins Reviewed-by: Yang Shi Cc: Signed-off-by: Andrew Morton --- --- a/mm/khugepaged.c~mm-madv_collapse-set-eagain-on-unexpected-page-refcount +++ a/mm/khugepaged.c @@ -2611,6 +2611,7 @@ static int madvise_collapse_errno(enum s case SCAN_CGROUP_CHARGE_FAIL: return -EBUSY; /* Resource temporary unavailable - trying again might succeed */ + case SCAN_PAGE_COUNT: case SCAN_PAGE_LOCK: case SCAN_PAGE_LRU: case SCAN_DEL_PAGE_LRU: _ Patches currently in -mm which might be from zokeefe@google.com are