From patchwork Wed Sep 2 14:16:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 11750679 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65C381575 for ; Wed, 2 Sep 2020 14:16:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B11B208DB for ; Wed, 2 Sep 2020 14:16:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eMNuA3Jr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B11B208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 354D26B0082; Wed, 2 Sep 2020 10:16:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 304936B0083; Wed, 2 Sep 2020 10:16:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21AB16B0085; Wed, 2 Sep 2020 10:16:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 0CC446B0082 for ; Wed, 2 Sep 2020 10:16:16 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C68788248047 for ; Wed, 2 Sep 2020 14:16:15 +0000 (UTC) X-FDA: 77218321110.06.pull85_6309509270a1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 9A28F100372F0 for ; Wed, 2 Sep 2020 14:16:09 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,dhowells@redhat.com,,RULES_HIT:30034:30054:30064,0,RBL:216.205.24.124:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100;04yrcc8zyztox8yd767ckj4d73tinocot61tbrpdt7b6zf5n1m6oa4ragwu1gfe.mqn1pw5hobgrjfrn65qqsk4ncg9gpr6k9ssezap8rpjee9cupbbetit9ib18kz3.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: pull85_6309509270a1 X-Filterd-Recvd-Size: 3383 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Sep 2020 14:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599056168; h=from:from: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:content-transfer-encoding; bh=xUmKgg4xwWqmh+xeFrCeVaIW4I5DLAbupfKnbPLRKZg=; b=eMNuA3JreTbm6YnaaF6+Yc/OaFXwukYzdUmBXznreDwqKWWqi+/xgGaZ/D1lihkvAblKM+ hYiIPbKYUPn3eRtH9+2NkvqR3HvC4rQteA2co4qav+HTp4SOqHV7rVdJsJI1lqrOqlZ/ad MPek3p+HhS65qQW1i9A9fGgIJ+mEn34= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-6g7IpWajN7SOUrTJYe_W1Q-1; Wed, 02 Sep 2020 10:16:06 -0400 X-MC-Unique: 6g7IpWajN7SOUrTJYe_W1Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA03A425E2; Wed, 2 Sep 2020 14:16:04 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-113-6.rdu2.redhat.com [10.10.113.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE2427DA4A; Wed, 2 Sep 2020 14:16:03 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH] Fix khugepaged's request size in collapse_file() From: David Howells To: akpm@linux-foundation.org Cc: Song Liu , "Matthew Wilcox (Oracle)" , dhowells@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 02 Sep 2020 15:16:02 +0100 Message-ID: <159905616280.521200.12444250032673650063.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Rspamd-Queue-Id: 9A28F100372F0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: collapse_file() in khugepaged passes PAGE_SIZE as the number of pages to be read ahead to page_cache_sync_readahead(). It seems this was expressed as a number of bytes rather than a number of pages. 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 Acked-by: Song Liu Reviewed-by: Matthew Wilcox (Oracle) Acked-by: Yang Shi Acked-by: Pankaj Gupta --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 6d199c353281..f2d243077b74 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1706,7 +1706,7 @@ static void collapse_file(struct mm_struct *mm, 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);