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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 66ACCC43141 for ; Thu, 14 Nov 2019 13:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35BA62071B for ; Thu, 14 Nov 2019 13:19:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cp8V8v55" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbfKNNTh (ORCPT ); Thu, 14 Nov 2019 08:19:37 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:59003 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726190AbfKNNTg (ORCPT ); Thu, 14 Nov 2019 08:19:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573737575; 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=gVZa0sxBAr5GLog3z93mUnxYYBt4TLTYdErwxGV0hQ4=; b=cp8V8v55UZKRBdvFZcTlFiCwBjJLStWxkoCw1fUeFRrIogG5XK8Gi9DYYWzI8NFZmwdbBA LdbUgCTeLMlFRbD5fcGtDazrPkA5ret8/hGZvEn/yJCbvC0Somwg3VxfcPRtYmMCfe7/QO j3NATJJ8xBlFILD5dqbl5hNK+RT4Fqg= 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-215-K6qcfvHpPJ6VbumW4OQ1Zw-1; Thu, 14 Nov 2019 08:19:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43B238033CF; Thu, 14 Nov 2019 13:19:31 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0484A10013D9; Thu, 14 Nov 2019 13:19:25 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, David Hildenbrand , Michal Hocko , Andrew Morton , Oscar Salvador , Anshuman Khandual , Qian Cai , Pingfan Liu , Stephen Rothwell , Dan Williams , Pavel Tatashin , Vlastimil Babka , Mel Gorman , Mike Rapoport , Wei Yang , Alexander Duyck , Alexander Potapenko , Arun KS , Michael Ellerman Subject: [PATCH v2 2/2] mm: remove "count" parameter from has_unmovable_pages() Date: Thu, 14 Nov 2019 14:19:11 +0100 Message-Id: <20191114131911.11783-3-david@redhat.com> In-Reply-To: <20191114131911.11783-1-david@redhat.com> References: <20191114131911.11783-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: K6qcfvHpPJ6VbumW4OQ1Zw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the memory isolate notifier is gone, the parameter is always 0. Drop it and cleanup has_unmovable_pages(). Cc: Michal Hocko Cc: Andrew Morton Cc: Oscar Salvador Cc: Anshuman Khandual Cc: Qian Cai Cc: Pingfan Liu Cc: Stephen Rothwell Cc: Dan Williams Cc: Pavel Tatashin Cc: Vlastimil Babka Cc: Mel Gorman Cc: Mike Rapoport Cc: Wei Yang Cc: Alexander Duyck Cc: Alexander Potapenko Cc: Arun KS Cc: Michael Ellerman Signed-off-by: David Hildenbrand --- include/linux/page-isolation.h | 4 ++-- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 21 +++++++-------------- mm/page_isolation.c | 2 +- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.= h index 6861df759fad..148e65a9c606 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -33,8 +33,8 @@ static inline bool is_migrate_isolate(int migratetype) #define MEMORY_OFFLINE=090x1 #define REPORT_FAILURE=090x2 =20 -bool has_unmovable_pages(struct zone *zone, struct page *page, int count, -=09=09=09 int migratetype, int flags); +bool has_unmovable_pages(struct zone *zone, struct page *page, int migrate= type, +=09=09=09 int flags); void set_pageblock_migratetype(struct page *page, int migratetype); int move_freepages_block(struct zone *zone, struct page *page, =09=09=09=09int migratetype, int *num_movable); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3b5cee4d3f4e..f06d33748607 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1158,7 +1158,7 @@ static bool is_pageblock_removable_nolock(unsigned lo= ng pfn) =09if (!zone_spans_pfn(zone, pfn)) =09=09return false; =20 -=09return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, +=09return !has_unmovable_pages(zone, page, MIGRATE_MOVABLE, =09=09=09=09 MEMORY_OFFLINE); } =20 diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f5ecbacb0e04..e4d8f3a1a6b6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8270,17 +8270,15 @@ void *__init alloc_large_system_hash(const char *ta= blename, =20 /* * This function checks whether pageblock includes unmovable pages or not. - * If @count is not zero, it is okay to include less @count unmovable page= s * * PageLRU check without isolation or lru_lock could race so that * MIGRATE_MOVABLE block might include unmovable pages. And __PageMovable * check without lock_page also may miss some movable non-lru pages at * race condition. So you can't expect this function should be exact. */ -bool has_unmovable_pages(struct zone *zone, struct page *page, int count, -=09=09=09 int migratetype, int flags) +bool has_unmovable_pages(struct zone *zone, struct page *page, int migrate= type, +=09=09=09 int flags) { -=09unsigned long found; =09unsigned long iter =3D 0; =09unsigned long pfn =3D page_to_pfn(page); =09const char *reason =3D "unmovable page"; @@ -8306,13 +8304,11 @@ bool has_unmovable_pages(struct zone *zone, struct = page *page, int count, =09=09goto unmovable; =09} =20 -=09for (found =3D 0; iter < pageblock_nr_pages; iter++) { -=09=09unsigned long check =3D pfn + iter; - -=09=09if (!pfn_valid_within(check)) +=09for (; iter < pageblock_nr_pages; iter++) { +=09=09if (!pfn_valid_within(pfn + iter)) =09=09=09continue; =20 -=09=09page =3D pfn_to_page(check); +=09=09page =3D pfn_to_page(pfn + iter); =20 =09=09if (PageReserved(page)) =09=09=09goto unmovable; @@ -8361,11 +8357,9 @@ bool has_unmovable_pages(struct zone *zone, struct p= age *page, int count, =09=09if ((flags & MEMORY_OFFLINE) && PageHWPoison(page)) =09=09=09continue; =20 -=09=09if (__PageMovable(page)) +=09=09if (__PageMovable(page) || PageLRU(page)) =09=09=09continue; =20 -=09=09if (!PageLRU(page)) -=09=09=09found++; =09=09/* =09=09 * If there are RECLAIMABLE pages, we need to check =09=09 * it. But now, memory offline itself doesn't call @@ -8379,8 +8373,7 @@ bool has_unmovable_pages(struct zone *zone, struct pa= ge *page, int count, =09=09 * is set to both of a memory hole page and a _used_ kernel =09=09 * page at boot. =09=09 */ -=09=09if (found > count) -=09=09=09goto unmovable; +=09=09goto unmovable; =09} =09return false; unmovable: diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 21af88b718aa..1f8b9dfecbe8 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -37,7 +37,7 @@ static int set_migratetype_isolate(struct page *page, int= migratetype, int isol_ =09 * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. =09 * We just check MOVABLE pages. =09 */ -=09if (!has_unmovable_pages(zone, page, 0, migratetype, isol_flags)) { +=09if (!has_unmovable_pages(zone, page, migratetype, isol_flags)) { =09=09unsigned long nr_pages; =09=09int mt =3D get_pageblock_migratetype(page); =20 --=20 2.21.0 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=-6.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 AF6F1C432C3 for ; Thu, 14 Nov 2019 13:37:30 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E1A1206E1 for ; Thu, 14 Nov 2019 13:37:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A1AXm7TQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E1A1206E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47DMwl2VkQzF4BN for ; Fri, 15 Nov 2019 00:37:27 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.120; helo=us-smtp-1.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="A1AXm7TQ"; dkim-atps=neutral Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47DMXH1NKHzF7x2 for ; Fri, 15 Nov 2019 00:19:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573737579; 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=gVZa0sxBAr5GLog3z93mUnxYYBt4TLTYdErwxGV0hQ4=; b=A1AXm7TQUD31s7NKfNk8Rluf69/yceYhvoJIdvWdmxfHfk7wW/lBBmjHFIzpun1UHMH+sD Ew8VfXEuwQnC/45wTmKXEljviNzDS7U//Pamc9xgSRP+sC94OQaO9dmTqpIAxf+oz2x+MO 2mA9o9DI9gDWpiP1P6EfW4eK6Ch51+Q= 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-215-K6qcfvHpPJ6VbumW4OQ1Zw-1; Thu, 14 Nov 2019 08:19:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43B238033CF; Thu, 14 Nov 2019 13:19:31 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0484A10013D9; Thu, 14 Nov 2019 13:19:25 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] mm: remove "count" parameter from has_unmovable_pages() Date: Thu, 14 Nov 2019 14:19:11 +0100 Message-Id: <20191114131911.11783-3-david@redhat.com> In-Reply-To: <20191114131911.11783-1-david@redhat.com> References: <20191114131911.11783-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: K6qcfvHpPJ6VbumW4OQ1Zw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephen Rothwell , Michal Hocko , Pavel Tatashin , David Hildenbrand , Mel Gorman , Alexander Duyck , Anshuman Khandual , Pingfan Liu , linux-mm@kvack.org, Mike Rapoport , Qian Cai , Wei Yang , Arun KS , Alexander Potapenko , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Dan Williams , Vlastimil Babka , Oscar Salvador Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Now that the memory isolate notifier is gone, the parameter is always 0. Drop it and cleanup has_unmovable_pages(). Cc: Michal Hocko Cc: Andrew Morton Cc: Oscar Salvador Cc: Anshuman Khandual Cc: Qian Cai Cc: Pingfan Liu Cc: Stephen Rothwell Cc: Dan Williams Cc: Pavel Tatashin Cc: Vlastimil Babka Cc: Mel Gorman Cc: Mike Rapoport Cc: Wei Yang Cc: Alexander Duyck Cc: Alexander Potapenko Cc: Arun KS Cc: Michael Ellerman Signed-off-by: David Hildenbrand --- include/linux/page-isolation.h | 4 ++-- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 21 +++++++-------------- mm/page_isolation.c | 2 +- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.= h index 6861df759fad..148e65a9c606 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -33,8 +33,8 @@ static inline bool is_migrate_isolate(int migratetype) #define MEMORY_OFFLINE=090x1 #define REPORT_FAILURE=090x2 =20 -bool has_unmovable_pages(struct zone *zone, struct page *page, int count, -=09=09=09 int migratetype, int flags); +bool has_unmovable_pages(struct zone *zone, struct page *page, int migrate= type, +=09=09=09 int flags); void set_pageblock_migratetype(struct page *page, int migratetype); int move_freepages_block(struct zone *zone, struct page *page, =09=09=09=09int migratetype, int *num_movable); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3b5cee4d3f4e..f06d33748607 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1158,7 +1158,7 @@ static bool is_pageblock_removable_nolock(unsigned lo= ng pfn) =09if (!zone_spans_pfn(zone, pfn)) =09=09return false; =20 -=09return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, +=09return !has_unmovable_pages(zone, page, MIGRATE_MOVABLE, =09=09=09=09 MEMORY_OFFLINE); } =20 diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f5ecbacb0e04..e4d8f3a1a6b6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8270,17 +8270,15 @@ void *__init alloc_large_system_hash(const char *ta= blename, =20 /* * This function checks whether pageblock includes unmovable pages or not. - * If @count is not zero, it is okay to include less @count unmovable page= s * * PageLRU check without isolation or lru_lock could race so that * MIGRATE_MOVABLE block might include unmovable pages. And __PageMovable * check without lock_page also may miss some movable non-lru pages at * race condition. So you can't expect this function should be exact. */ -bool has_unmovable_pages(struct zone *zone, struct page *page, int count, -=09=09=09 int migratetype, int flags) +bool has_unmovable_pages(struct zone *zone, struct page *page, int migrate= type, +=09=09=09 int flags) { -=09unsigned long found; =09unsigned long iter =3D 0; =09unsigned long pfn =3D page_to_pfn(page); =09const char *reason =3D "unmovable page"; @@ -8306,13 +8304,11 @@ bool has_unmovable_pages(struct zone *zone, struct = page *page, int count, =09=09goto unmovable; =09} =20 -=09for (found =3D 0; iter < pageblock_nr_pages; iter++) { -=09=09unsigned long check =3D pfn + iter; - -=09=09if (!pfn_valid_within(check)) +=09for (; iter < pageblock_nr_pages; iter++) { +=09=09if (!pfn_valid_within(pfn + iter)) =09=09=09continue; =20 -=09=09page =3D pfn_to_page(check); +=09=09page =3D pfn_to_page(pfn + iter); =20 =09=09if (PageReserved(page)) =09=09=09goto unmovable; @@ -8361,11 +8357,9 @@ bool has_unmovable_pages(struct zone *zone, struct p= age *page, int count, =09=09if ((flags & MEMORY_OFFLINE) && PageHWPoison(page)) =09=09=09continue; =20 -=09=09if (__PageMovable(page)) +=09=09if (__PageMovable(page) || PageLRU(page)) =09=09=09continue; =20 -=09=09if (!PageLRU(page)) -=09=09=09found++; =09=09/* =09=09 * If there are RECLAIMABLE pages, we need to check =09=09 * it. But now, memory offline itself doesn't call @@ -8379,8 +8373,7 @@ bool has_unmovable_pages(struct zone *zone, struct pa= ge *page, int count, =09=09 * is set to both of a memory hole page and a _used_ kernel =09=09 * page at boot. =09=09 */ -=09=09if (found > count) -=09=09=09goto unmovable; +=09=09goto unmovable; =09} =09return false; unmovable: diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 21af88b718aa..1f8b9dfecbe8 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -37,7 +37,7 @@ static int set_migratetype_isolate(struct page *page, int= migratetype, int isol_ =09 * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. =09 * We just check MOVABLE pages. =09 */ -=09if (!has_unmovable_pages(zone, page, 0, migratetype, isol_flags)) { +=09if (!has_unmovable_pages(zone, page, migratetype, isol_flags)) { =09=09unsigned long nr_pages; =09=09int mt =3D get_pageblock_migratetype(page); =20 --=20 2.21.0