Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1863116pxk; Tue, 1 Sep 2020 09:29:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzs+FwSU8ClmVaUoBaZi8QwBv6kf6258F622lZRgt2HNZKIIkrEBR0cRdl21pJL5ZHX+qd X-Received: by 2002:a05:6402:a:: with SMTP id d10mr2379799edu.60.1598977782562; Tue, 01 Sep 2020 09:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598977782; cv=none; d=google.com; s=arc-20160816; b=xd+x8mx89W3DSCpRT5SfIMzh3xOYroEz+1yTUVQF+FIefTCSq2U/wfHDDPIPmYi078 4JvSWY3NTmOnuS6EGywVsDYH+GbdOhrU4j4s9z2Qvm2O91hfeOy/92UfVYOnf5lBrfk9 EYiQ2vyOVF6/IQDN7avGp09Icqazrq+YHBIaU9HVsmVpkpWuXeOaNsIideP/efk6q4RS fkuVtIn1YmN63k2LCju4ezQToQJK+ydRmLozCulP64ladxo9J9LlVJ66AsZjul3nU91h DoZLU+oFrtAGplDlkqrusFZqyIOSBT7pkl7lGp+x6sErHQLgrC0beTFhZZsfmFQe4iX1 cwxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=aTnz/AaJx61OeSfsF40kwfwZQcF1Wav17QC/9an/tGk=; b=ZOqVdzdNGV5RDAOUjJgKWF1Ge73ft2zwTsxhE9HpKSdU5QV45Fzx4mnunpZJTOzHSu lWvPXRXoC7I8wfsadcv3LiBtSO2/xVDLNFa9ymgiJIfb1LMBzF+zWEl9+/JNnGPw4Kl3 35vVretO7D8DcZ1rB8ORL7rMOjZHX+sDPVGxH6peErzYo6CDPMCRyMdmElBc4Z4pZyxE +Qn5CCGivgqNZR4NucFArpNubzfkrrrfEh907Riwy4+auW63qZt4OF7MqaUFcvcHKQl6 ovYXbUlgq69zz7aOAmljA+fOrS2wKZpiTyheKNDSz+bXYRN/3aq/JpWk5objGauv4Q8c q2rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NZnOhBI/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz19si942873ejb.307.2020.09.01.09.29.18; Tue, 01 Sep 2020 09:29:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NZnOhBI/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731020AbgIAQ2m (ORCPT + 99 others); Tue, 1 Sep 2020 12:28:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46226 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730929AbgIAQ23 (ORCPT ); Tue, 1 Sep 2020 12:28:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598977707; 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: in-reply-to:in-reply-to:references:references; bh=aTnz/AaJx61OeSfsF40kwfwZQcF1Wav17QC/9an/tGk=; b=NZnOhBI/ZnlExqDujBTv5XYWHW6OnVxiZcV/acCR1ZlitHgI3uNrKMa/nnOm5BYRIDFc0E TRj6S3AnMmN2y5oMaXmCXPJixSB69MMHkZRARWGlpf2RV+0bLW6hE9Mu9L7dDA1zccUH2X b0vROx7Q7GTttai/53Hjc2gQ4V/GBGk= 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-293-mAcqF4gmO_e3Y975aLiNFQ-1; Tue, 01 Sep 2020 12:28:26 -0400 X-MC-Unique: mAcqF4gmO_e3Y975aLiNFQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B41578014D9; Tue, 1 Sep 2020 16:28:24 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-113-231.rdu2.redhat.com [10.10.113.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 456CE5C1A3; Tue, 1 Sep 2020 16:28:23 +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: [RFC PATCH 1/7] Fix khugepaged's request size in collapse_file() From: David Howells To: willy@infradead.org Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Tue, 01 Sep 2020 17:28:22 +0100 Message-ID: <159897770245.405783.16506873187032379873.stgit@warthog.procyon.org.uk> In-Reply-To: <159897769535.405783.17587409235571100774.stgit@warthog.procyon.org.uk> References: <159897769535.405783.17587409235571100774.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 cc: Matthew Wilcox cc: Song Liu --- 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);