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=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 2CC48C433DF for ; Tue, 25 Aug 2020 08:26:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF4E32067C for ; Tue, 25 Aug 2020 08:26:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF4E32067C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1CD796B008C; Tue, 25 Aug 2020 04:26:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17E546B0092; Tue, 25 Aug 2020 04:26:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0959E6B0093; Tue, 25 Aug 2020 04:26:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id E53CF6B008C for ; Tue, 25 Aug 2020 04:26:26 -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 A1DFA8248047 for ; Tue, 25 Aug 2020 08:26:26 +0000 (UTC) X-FDA: 77188409172.06.chain86_3a0f4e22705a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 6C23C1003EC02 for ; Tue, 25 Aug 2020 08:26:26 +0000 (UTC) X-HE-Tag: chain86_3a0f4e22705a X-Filterd-Recvd-Size: 2991 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Aug 2020 08:26:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 29F33AE7A; Tue, 25 Aug 2020 08:26:55 +0000 (UTC) Date: Tue, 25 Aug 2020 10:26:23 +0200 From: Michal Hocko To: Li Xinhai Cc: linux-mm@kvack.org, akpm@linux-foundation.org, david@redhat.com Subject: Re: [PATCH] mm, isolation: avoid checking unmovable pages across pageblock boundary Message-ID: <20200825082623.GC22869@dhcp22.suse.cz> References: <20200824065811.383266-1-lixinhai.lxh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200824065811.383266-1-lixinhai.lxh@gmail.com> X-Rspamd-Queue-Id: 6C23C1003EC02 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 24-08-20 14:58:11, Li Xinhai wrote: > In has_unmovable_pages(), the page parameter would not always be the > first page within a pageblock (see how the page pointer is passed in from > start_isolate_page_range() after call __first_valid_page()), so that > would cause checking unmovable pages span two pageblocks. This might lead to false negatives when an unrelated block would cause an isolation failure. > After this patch, the checking is enforced within one pageblock no matter > the page is first one or not, and obey the semantics of this function. > > This issue is found by code inspection. > > Signed-off-by: Li Xinhai I have tried to find the commit which has introduced this but there was so much churn around that I gave up. Not that we care all that much because it seems that we simply never try to isolate pageblocks with holes. Memory hotplug disallows that explicitly and the CMA allocator doesn't trip over that either. Or maybe we were just lucky or a silent failure didn't really trigger any attention. Anyway, good to have it fixed. Acked-by: Michal Hocko > --- > mm/page_alloc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 0e2bab486fea..c2c5b565f1f3 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8213,6 +8213,7 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page, > { > unsigned long iter = 0; > unsigned long pfn = page_to_pfn(page); > + unsigned long offset = pfn % pageblock_nr_pages; > > /* > * TODO we could make this much more efficient by not checking every > @@ -8234,7 +8235,7 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page, > return page; > } > > - for (; iter < pageblock_nr_pages; iter++) { > + for (; iter < pageblock_nr_pages - offset; iter++) { > if (!pfn_valid_within(pfn + iter)) > continue; > > -- > 2.18.4 > -- Michal Hocko SUSE Labs