Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp583685ybp; Fri, 4 Oct 2019 01:28:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwszF0okJMyupi+V2St9dd+x7IGcrXR8NwEclJAvaoOGYHRnDNqa5NiiRLY1tFLVEvFJFqJ X-Received: by 2002:a50:d808:: with SMTP id o8mr13941185edj.74.1570177728480; Fri, 04 Oct 2019 01:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570177728; cv=none; d=google.com; s=arc-20160816; b=zqvyEaZpvolSOun5Ell9YXnU/xGF/AcspvC9wlrI1HlKhFqAXA9RM9btuQuE1VOhKt yGoj0y1jn9rjUccc8vek3xAws/UmA+eGnjOEe4oBMEb20f+su4QR1k8GTrEKDdux6LZz jWeHk1tgAq8C9oO/87nN39ZbifWpjRoDeiwNX4Lm7BiTp1+PfDEWHQDv0sgWpMcNAYS4 8jXVGzsnaOL5tkKmaBWrtTdc0hppPfJ8ASLqtWqEXecpD6qxmQqKBvurCrjQwnVCmURu CrMkIxsLNGZC3MtRU/SvoCxFE0T/kSl9AYVhDgNdcQ1MrXZp0w0j+3piWyaU0u126qck nWtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=5KoCB+Ov7mzZyBoKwxX6ke9DVsJcWK8No/qEMU+L3CQ=; b=ey1CCDuZTUMGvKqYKEwSdarMJoR+0wKI2xSMVNpQJ3+ssMgpRghHmPQuOptbMaeRJY KKZAM6ySUb732wlgkxCMINcLev6f4nm1IfX46NG20QPRnFpanst9ubJsZh6SxoPc2mDp /ZskCFXv/CvkD/x0tVEEXW6LLixjUTiA157DC5LlNbSfByuBQtv22hM+sU/nR9YBRE87 H8FfypzNBU1YipsGxukKLCjfuInqMsc6surFrVmj10HgixcLEAEAmLXwxEKPvvrxYRMO IVOdNGilidZuUOM5ZgSijY2VgJh5qL0sYmZ8FRjAUSMyb54/Bubn3wJUMgy7UBAm+vVM dhJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22si2610167ejz.218.2019.10.04.01.28.24; Fri, 04 Oct 2019 01:28:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730325AbfJDH7l (ORCPT + 99 others); Fri, 4 Oct 2019 03:59:41 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15870 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725932AbfJDH7l (ORCPT ); Fri, 4 Oct 2019 03:59:41 -0400 X-UUID: 144424648c3244ed8d0c6c7f5cadc265-20191004 X-UUID: 144424648c3244ed8d0c6c7f5cadc265-20191004 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1001643015; Fri, 04 Oct 2019 15:59:35 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 4 Oct 2019 15:59:33 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 4 Oct 2019 15:59:33 +0800 Message-ID: <1570175974.23700.0.camel@mtkswgap22> Subject: Re: [PATCH] mm/page_owner: fix incorrect looping in __set_page_owner_handle() From: Miles Chen To: Vlastimil Babka CC: Andrew Morton , , , , , Michal Hocko Date: Fri, 4 Oct 2019 15:59:34 +0800 In-Reply-To: References: <20191004073755.3228-1-miles.chen@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-10-04 at 09:57 +0200, Vlastimil Babka wrote: > On 10/4/19 9:37 AM, Miles Chen wrote: > > In __set_page_owner_handle(), we should loop over page > > [0...(1 << order) - 1] and setup their page_owner structures. > > > > Currently, __set_page_owner_handle() update page_ext at the end of > > the loop, sets the page_owner of (page + 0) twice and > > misses the page_owner of (page + (1 << order) - 1). > > > > Fix it by updating the page_ext at the start of the loop. > > > > In i == 0 case: > > for (i = 0; i < (1 << order); i++) { > > page_owner = get_page_owner(page_ext); <- page_ext belongs to page + 0 > > ... > > page_ext = lookup_page_ext(page + i); <- lookup_page_ext(page + 0) > > } > > > > Cc: Andrew Morton > > Cc: Vlastimil Babka > > Cc: Michal Hocko > > Signed-off-by: Miles Chen > > Fixes: 7e2f2a0cd17c ("mm, page_owner: record page owner for each subpage") > > Thanks. Kirill spotted it earlier and there's a fix pending: > https://lore.kernel.org/linux-mm/20190930122916.14969-2-vbabka@suse.cz/ Great. thanks for the information. Miles > > > --- > > mm/page_owner.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/mm/page_owner.c b/mm/page_owner.c > > index dee931184788..110c3e1987f2 100644 > > --- a/mm/page_owner.c > > +++ b/mm/page_owner.c > > @@ -178,6 +178,7 @@ static inline void __set_page_owner_handle(struct page *page, > > int i; > > > > for (i = 0; i < (1 << order); i++) { > > + page_ext = lookup_page_ext(page + i); > > page_owner = get_page_owner(page_ext); > > page_owner->handle = handle; > > page_owner->order = order; > > @@ -185,8 +186,6 @@ static inline void __set_page_owner_handle(struct page *page, > > page_owner->last_migrate_reason = -1; > > __set_bit(PAGE_EXT_OWNER, &page_ext->flags); > > __set_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags); > > - > > - page_ext = lookup_page_ext(page + i); > > } > > } > > > > >