From patchwork Tue Apr 4 12:01:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Stevens X-Patchwork-Id: 13199706 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 E3680C761A6 for ; Tue, 4 Apr 2023 12:01:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B8FD6B0074; Tue, 4 Apr 2023 08:01:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 642886B0075; Tue, 4 Apr 2023 08:01:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 509AC6B0078; Tue, 4 Apr 2023 08:01:33 -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 399546B0074 for ; Tue, 4 Apr 2023 08:01:33 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F0410140E9D for ; Tue, 4 Apr 2023 12:01:32 +0000 (UTC) X-FDA: 80643568824.11.B20D515 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf24.hostedemail.com (Postfix) with ESMTP id D6D1C18001D for ; Tue, 4 Apr 2023 12:01:30 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=GhUPSo9s; spf=pass (imf24.hostedemail.com: domain of stevensd@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680609690; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BXv1GcIP0b01WCB0dxAHE5qtL4a0jd48WmxV6aMJGEI=; b=ov4YW9IgBg1Z4lfvlierPyv0aSQwbESZm57Q/4yR4sjpo7S6zlvioWz47mAtr6emWjOHSU yKB8oJtdF5KMR5d/o+U1/ND9Art6v53HHFi5n10MnMSaaqS+eZM4H6pTaVXljI97BzVVMN ocT5EmxJUUEnVUL5+AZK6DOFfB/58J0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=GhUPSo9s; spf=pass (imf24.hostedemail.com: domain of stevensd@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=stevensd@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680609690; a=rsa-sha256; cv=none; b=r4ejEmEE/rM5xvhfocBbpqGRrY2mywhKQsaGAcmq0UpCzqMF4rBNAwYoIGoMTUWbrlxRzE IJXcxE/OaKlUHKL31MePt/LlgebmnixD+5CIzdAz8sWEVkwnvUCxYJ+8fTZ0MFPXEl3Kca pz/DhEA82YtTR/MKGw/Sw0dgQOh/gjM= Received: by mail-pl1-f176.google.com with SMTP id n14so15175278plc.8 for ; Tue, 04 Apr 2023 05:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680609689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BXv1GcIP0b01WCB0dxAHE5qtL4a0jd48WmxV6aMJGEI=; b=GhUPSo9sh6Zwwfo4h+KoyiwNBesV7G+G8J1L0pQX0JIU2wZv09kHmO7svPlTwq7tWY W0Wc6i0y6qoBqfdiEgvioqzZqSn479UQH0LZb+QYhGBOawXvCQgAYwZy+crfeg95NXWc /4gHmZ1MbS8u0pbiY4snCi0+AH22BTnSmnjRM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680609689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BXv1GcIP0b01WCB0dxAHE5qtL4a0jd48WmxV6aMJGEI=; b=BxxXaM1KlmgJhi80si30tIlbpU990sgz7tl3neOe6YekJQSgjwKwAk4eXbgzKn2L6e npuAiCFQXKP6S12MiHdEXbzqi1gAemPWRRlqSwvcNI8hXuvpQR/o40CfNGpGKA0tOvyR 4RyHqsKYNytymzW10oWLtIPlghQ1uikOfSLwBxnTAo+ObiaWxWCmE3p+HIWgYCraKBMn JWxj/IZCb9ej9WRUIH7xps3qM6vAmN6YBhYSS6IUQcVRdN/Ezbc9ZyW/dpfsSpJUpAi6 y6N/hAfNEYXiCmtL1WSXebUcBd1G6u/J7spJ+xwbMZ63j4ef2AnEi5P3NM6lD7n6atSE Ca7w== X-Gm-Message-State: AAQBX9eYnkDzawqxr0M4nWU+Vbzizpq58xstDQXVqIcknbwS6DnpcJ6g Cv0HwXN0swueH++vYcarnzVZrWfKRcnu09bo5q4= X-Google-Smtp-Source: AKy350asjKP3U0+twDNYb29W50NssXzM9KfQVg707hZ1pElnupMPu2X9cFoRAu3bB4exQZa/RnwHDg== X-Received: by 2002:a17:903:32c2:b0:1a2:98b1:1ee2 with SMTP id i2-20020a17090332c200b001a298b11ee2mr3128683plr.15.1680609689270; Tue, 04 Apr 2023 05:01:29 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:959b:21ea:166b:c273]) by smtp.gmail.com with UTF8SMTPSA id l2-20020a17090aec0200b0022335f1dae2sm7834214pjy.22.2023.04.04.05.01.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Apr 2023 05:01:28 -0700 (PDT) From: David Stevens X-Google-Original-From: David Stevens To: linux-mm@kvack.org, Peter Xu , Hugh Dickins Cc: Andrew Morton , Matthew Wilcox , "Kirill A . Shutemov" , Yang Shi , David Hildenbrand , Jiaqi Yan , linux-kernel@vger.kernel.org, David Stevens Subject: [PATCH v6 1/4] mm/khugepaged: drain lru after swapping in shmem Date: Tue, 4 Apr 2023 21:01:14 +0900 Message-Id: <20230404120117.2562166-2-stevensd@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230404120117.2562166-1-stevensd@google.com> References: <20230404120117.2562166-1-stevensd@google.com> MIME-Version: 1.0 X-Stat-Signature: ggodoiy4n936t4y9adx5ropwhtkaetcy X-Rspam-User: X-Rspamd-Queue-Id: D6D1C18001D X-Rspamd-Server: rspam06 X-HE-Tag: 1680609690-88332 X-HE-Meta: U2FsdGVkX1+sYUCQBAsqxLBWsJmWDHsoTKZHTFauFDpu4idwN+M01rn0bUfqIt8UsNxaLo8LNt17XIGZ1+BkocD0Pv7Bk/cQ1WoCV6AoKff7r8Xnffgjv3If2BZJ6PffBPbsMYrG/+gKCFJHzpMmdwqKS3cWKPflYa6Y8ArqUOPGPMZeOll3htFbbko/NII6+frqf/PCsio6wO/62wn+vcYOiQq+fvgYqWlRyK+VEbJgXeYj4fb7zHqx62e35C0BK5E9NPhkzQdQjXBABQWwcmRjv5CJx3MQKDTYzHNX/Jwqg4xPpK6rb0gDDZVa2rgtzkxU30IPb6ovfL8UV3hLspaT/piw/F9Ory1/wDPvdPW+8NSmI77TkgE379xykGnthzDh44oYACVisXC8SarG/Drg37fkrFktbfOfH477iaINLYm+Ln51aCrxbtaIkUXAS7mQl1q7Mcm9FVjkGqLLnNp4K47qd0hkXej2xs3D53opHyZuEywPrezpsWmIowoU3CS33+cebuHBAtIgq4c4Ot6lWtiH2uK503IYCjl4F8w3a80z7KfJepauqGZ9AEULLzaNAuQn0MBCl/WQoDenYrJb2eOJKYjgnF6HLyV/yG5JmW4xlAZizIzBIxTTdkPSGXnELBC5qBo6mMAmk1F0nYlnY/ZPZasNebXrwsqY+Kpxy/AgfgXpERQhFda9ivN7RBAuO6lFJRJ5aLqoWg2kl0EAMIfcm86Znf0H+X4ykxwDajbyKyDLz4+VC3YaXd7ZVQV5UYeHDQl3jnZWwnZgowx4ESBPyTloyPLlU13JhoUAFJ5tiAisLSPAYs4MJXsA+VkVmmWnf8o5dmmbOtnlqL7r/xCaBXkIOw+Comv07S+PCPsY1ja7KUeHAXBa0SA5mlbTP8fuiBV5DfA2FiwHXQ/W4tzfJgNZQ2MhPOqCf/NDcdGWPZ54JSFUxaxhI2YZGXwyT2AOv3TYhpCk0HJ xoJX7pIz hQrH8qVTqTZQ4canvPWjJDFSsmcG/H/S3/KjFiy6474LDdVKQ0cIfG6SeALfLM9wgkv/19pVEwxX1TN8EUKq8Ac96tSAs+OcSaOvRtHwWvsjnuQM1I2vyB7bOMdvzHVl+kMNfrXn1pVRI7ikc9R/JrpxP4oRzlPyPj1HYAkNkU/zMqkb5wraiyzu64HqbkyD0PHDCZqQYqColNHhT0OD9ue+7f7u9ktk4QIYHef7JPzoz65pYRb0uuLKBGwPyNaPh/gOckyf5s/HyjLye/cI757wzdvuy4lLxV2jx48iCr8Ul37car7jKEgRKWJZicxYNwDdfw99bgydmXyG/Kxb/hqnuDTZGsBCQEPXD+fMhZYIpOi2yGe7eSf8uKw== 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: From: David Stevens Call lru_add_drain after swapping in shmem pages so that isolate_lru_page is more likely to succeed. Signed-off-by: David Stevens --- mm/khugepaged.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 666d2c4e38dd..90577247cfaf 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1963,6 +1963,8 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, result = SCAN_FAIL; goto xa_unlocked; } + /* drain pagevecs to help isolate_lru_page() */ + lru_add_drain(); page = folio_file_page(folio, index); } else if (trylock_page(page)) { get_page(page);