From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 D9755C4332D for ; Tue, 19 Jan 2021 18:37:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9212322E00 for ; Tue, 19 Jan 2021 18:37:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9212322E00 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 618136B002A; Tue, 19 Jan 2021 13:05:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EEAE6B002B; Tue, 19 Jan 2021 13:05:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 504DD6B002C; Tue, 19 Jan 2021 13:05:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 3B21C6B002A for ; Tue, 19 Jan 2021 13:05:15 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DFC84180AD82F for ; Tue, 19 Jan 2021 18:05:14 +0000 (UTC) X-FDA: 77723301348.14.error65_4102abe27553 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id B2E601822989D for ; Tue, 19 Jan 2021 18:05:14 +0000 (UTC) X-HE-Tag: error65_4102abe27553 X-Filterd-Recvd-Size: 4812 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 18:05:14 +0000 (UTC) Received: by mail-qk1-f177.google.com with SMTP id d14so22691492qkc.13 for ; Tue, 19 Jan 2021 10:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VdWMG/uGCJ43g2jyUu+cOqHYdfz8BVsdLX4Jg//Lvgk=; b=j05GmtUhLQZqMespMujz2B04lEC5T+G/IfPEWSLg9vszMTM84+Zwtv7YEyyGBOnOMD YZC13ZpoqFi0CBqzxMyMLz5MGzx9rrfUGkf8WoTmWLe+XPRMAlK9wStYfMqqlkPknPAq yGDvTKn7uo+pfQGH7wmxQgS0VxVr6WuRqwgAHe+hR8rmQgHR51984f46IM/N2BUDhuUS YJMag/9hIm93ON0T4gX5kXGSFdmvo91YglWHnbp2mCOm7C6wA5Cg0t+d33mCD3gJD5CY VLG4PZoRo65ssQgEKGnjk49NqZBmRBjXDP1dFdICMM9Iv1Yj7cOvkh0ctNhWEORsk4bd 7Mqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VdWMG/uGCJ43g2jyUu+cOqHYdfz8BVsdLX4Jg//Lvgk=; b=a8fia6nxcKdOSXaVX9RSso4WfhNRoPyCCEd2BUT5lLH6vE/1yZlet1S3k1K6qeKOlK YkNnUatc3Z8NntUnbb10t0JxOf+SHsmPxUOhJhARe8ejyUcQ/KeDhhYOAZRn0FWHtIHc 1ZAPqMc6zBVmIvGcO3TAJtzztSDSmnlY5MfhiPvLiffXDexiotbV7Kl3ldFxLBHMRR3K m8v8sjQKPK6ZoVpWIQ+DqLxnkrWKsk5gdbCsTamPi83WZ0/T19DpqcOEIW4/MV1vLcdW cR0uEX3ktnyuD9O3GmCZxdlQJ2byy6pwoGqGtCnpj++9hyu/W4nEy20QmJhxviaQSe3H 37qw== X-Gm-Message-State: AOAM532ro2/ufa1jGwUzvREP0VTcxWHnsKWP1uQzE24RxwPCfyTFDXN0 KTpYIAdORz02a5avwTmsCoQBaA== X-Google-Smtp-Source: ABdhPJx7MA8sBMbEtUSV41m+37ci8w0m1RGlrZnwqu/7wxd6/5Vt3/6VIuQwvxqlLT6y5Ik3JcwCyA== X-Received: by 2002:a37:a50c:: with SMTP id o12mr5590816qke.98.1611079513428; Tue, 19 Jan 2021 10:05:13 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id o5sm12802873qti.47.2021.01.19.10.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 10:05:13 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l1vNQ-003pFv-F7; Tue, 19 Jan 2021 14:05:12 -0400 Date: Tue, 19 Jan 2021 14:05:12 -0400 From: Jason Gunthorpe To: Pavel Tatashin Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, david@redhat.com, osalvador@suse.de, dan.j.williams@intel.com, sashal@kernel.org, tyhicks@linux.microsoft.com, iamjoonsoo.kim@lge.com, mike.kravetz@oracle.com, rostedt@goodmis.org, mingo@redhat.com, peterz@infradead.org, mgorman@suse.de, willy@infradead.org, rientjes@google.com, jhubbard@nvidia.com, linux-doc@vger.kernel.org, ira.weiny@intel.com, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v5 02/14] mm/gup: check every subpage of a compound page during isolation Message-ID: <20210119180512.GY4605@ziepe.ca> References: <20210119043920.155044-1-pasha.tatashin@soleen.com> <20210119043920.155044-3-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210119043920.155044-3-pasha.tatashin@soleen.com> 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: On Mon, Jan 18, 2021 at 11:39:08PM -0500, Pavel Tatashin wrote: > When pages are isolated in check_and_migrate_movable_pages() we skip > compound number of pages at a time. However, as Jason noted, it is > not necessary correct that pages[i] corresponds to the pages that > we skipped. This is because it is possible that the addresses in > this range had split_huge_pmd()/split_huge_pud(), and these functions > do not update the compound page metadata. > > The problem can be reproduced if something like this occurs: > > 1. User faulted huge pages. > 2. split_huge_pmd() was called for some reason > 3. User has unmapped some sub-pages in the range > 4. User tries to longterm pin the addresses. > > The resulting pages[i] might end-up having pages which are not compound > size page aligned. > > Fixes: aa712399c1e8 ("mm/gup: speed up check_and_migrate_cma_pages() on huge page") > > Reported-by: Jason Gunthorpe No new line after fixes > Signed-off-by: Pavel Tatashin > mm/gup.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) Looks good Reviewed-by: Jason Gunthorpe Thanks, Jason