From patchwork Tue Sep 8 15:25:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCB7DC2D0A7 for ; Tue, 8 Sep 2020 18:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88FB62078B for ; Tue, 8 Sep 2020 18:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599588793; bh=rVIo+8RZQmBxaBCS8io8NeMrC2dTF3JgVwuQZDuKAaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ts+ulMZi7nRtMa9V8EvxkhBZgLmJePV/FWxV1BOfmNFyhldMTL90Nccq2TgnYVeag bGlE06hxmi5upYRpK3N1MckACbPD0qff4oDxVLtPIw11VtrkKNrnSPJMPrHd0eBtp7 775LbBQGunsEbFWC+KgKJ92pjth6b5rJIZ7C76DE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732004AbgIHSMb (ORCPT ); Tue, 8 Sep 2020 14:12:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:55372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731484AbgIHQLn (ORCPT ); Tue, 8 Sep 2020 12:11:43 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B91632475B; Tue, 8 Sep 2020 15:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579695; bh=rVIo+8RZQmBxaBCS8io8NeMrC2dTF3JgVwuQZDuKAaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w1VKEcaKKCHF/+hgvip6AFKnJWfBSzzs74Kg2Vb42BAw8qGkLKv/tc0qYnf62b0jU 7jqyILRq0vniY475zm7HwdT/n0pL0EWlRYHVu/a4ovAd7Z9oQvtUyC9NWiXNl60k1v qTpCd7B2HQVpzQrGR0qRHkylMAd/rxugFcB1FPBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , "Matthew Wilcox (Oracle)" , Andrew Morton , Song Liu , Yang Shi , Pankaj Gupta , Eric Biggers , Linus Torvalds Subject: [PATCH 5.8 184/186] mm/khugepaged.c: fix khugepageds request size in collapse_file Date: Tue, 8 Sep 2020 17:25:26 +0200 Message-Id: <20200908152250.590773261@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152241.646390211@linuxfoundation.org> References: <20200908152241.646390211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Howells commit e5a59d308f52bb0052af5790c22173651b187465 upstream. collapse_file() in khugepaged passes PAGE_SIZE as the number of pages to be read to page_cache_sync_readahead(). The intent was probably to read a single page. Fix it to use the number of pages to the end of the window instead. Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: David Howells Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Reviewed-by: Matthew Wilcox (Oracle) Acked-by: Song Liu Acked-by: Yang Shi Acked-by: Pankaj Gupta Cc: Eric Biggers Link: https://lkml.kernel.org/r/20200903140844.14194-2-willy@infradead.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_stru xas_unlock_irq(&xas); page_cache_sync_readahead(mapping, &file->f_ra, file, index, - PAGE_SIZE); + end - index); /* drain pagevecs to help isolate_lru_page() */ lru_add_drain(); page = find_lock_page(mapping, index);