Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1058832imm; Fri, 29 Jun 2018 10:39:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccOkWSZENQAIRVOq2urOdiuTMkU80EF/VXoEK8IvOoPaS3Gv9WZIWIQD68bUUeULWIVzk4 X-Received: by 2002:a65:6102:: with SMTP id z2-v6mr8235pgu.46.1530293940335; Fri, 29 Jun 2018 10:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530293940; cv=none; d=google.com; s=arc-20160816; b=ywMtHDB87TpWUxfrhrII9EhfLHpUPPGUssq0x6wfTtXhN8gKQ/KDIvCJU5cZP+By8V 4RHRHQgCgFRtB+7p9004zc8VcERxPrQ05E2MBb2FTKyOI3pMqlS3vJHLZMaEWhG5qNM+ vo4VN8LsAMrIXF98gi6v+nAfXFT3P/XR7tFeBne9u/HbgaqzBNRj+K3wcWwyD41+ZTAL 44RayHwd86uHHxH3eunqYxmVIjjkMSMRC3KMO7Xtfd+dZtVLODQ2lw7UwvBRLDrohENo Kohj78PJAtP5hapJC27jxyduKUjpC2NFDDSxkw4//5Knj1hLASPfMwN9OnzZOrbQoNIh yogQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=pItollnNKjkcDrxUTog7rPhfMiAZpLz8QKlQzUTDN1Q=; b=vFzpl+pWLmlFfRY9LXUrtxTN8ep0w/LJnjf2rfGhuqadrz2T+3H7I2i17LLpdpsUSQ xH9kobRgGdFfSULlZbAb0HL/uOdTRhmWcTvEihvIpFCbQz+EOqw8Liw/k8Pqoojv0ePu 9okdSAH1bOallCTZCKRmT/IehdNvF/8ebdF4ep8c9O75eZY82VTBRIPSVTFpuyNbxlrr 9rLJtXSeLf4ZaQITaNGO+8wusWdDOjQYynJdhcncTmSVxZrpWCzZlnoj3wooFiPJCByA lBk9Lm3xWpGTzTU5emlDjptCqdf204OKOcrOoiJYDW1CifZtdKqlI3MJiIyIMFVAUv4C xhOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=r4GONVjx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r28-v6si6380621pfb.65.2018.06.29.10.38.46; Fri, 29 Jun 2018 10:39:00 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=r4GONVjx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935500AbeF2RHp (ORCPT + 99 others); Fri, 29 Jun 2018 13:07:45 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43660 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932446AbeF2RHo (ORCPT ); Fri, 29 Jun 2018 13:07:44 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5TH40xv030249 for ; Fri, 29 Jun 2018 17:07:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=pItollnNKjkcDrxUTog7rPhfMiAZpLz8QKlQzUTDN1Q=; b=r4GONVjxyLFmMfq6GUUeP5lQlzE03Y/gJzuCdwzrBaHycJph90TP1VfzRzoZ8Kinrf1H wdIFGxq0MKv8bL6+duBAzQx6p+FpSij2SmNm4QHfQykTBhiDIAc75NbxnENGzIXu09u+ wtg1duuMrf5Za+rBJHvEWJ1ZlRUj4yCsI+I+ZP8lCBYzRLmXGJZIQjULbnXdr8jZQTy8 UIvjujdYIIZGPE0Vz942X1uVTGZ1EFR7xoDOStrrRFEfJdk3LJZCJqRPDLUaMW6wjhvM IuzZ7/nayskMwVr2QL7tDI12H8BKeSQF9yBu9/HC2YYtdaw11VbUUsFc2iKUZkwb4XHi qQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2jum587979-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 Jun 2018 17:07:43 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5TH7dWv019551 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 Jun 2018 17:07:39 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5TH7dV9018494 for ; Fri, 29 Jun 2018 17:07:39 GMT Received: from mail-ot0-f169.google.com (/74.125.82.169) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 29 Jun 2018 10:07:38 -0700 Received: by mail-ot0-f169.google.com with SMTP id i17-v6so10673653otl.1 for ; Fri, 29 Jun 2018 10:07:38 -0700 (PDT) X-Gm-Message-State: APt69E1uE562BXHLB3kExDcrgoiGeP83clzn443i8HhthmCapnPQnQmY ClIiZZhhn+RlcykUooBY0J+DR64VvtEAOeH7uuM= X-Received: by 2002:a9d:2e0e:: with SMTP id q14-v6mr6986688otb.275.1530292058245; Fri, 29 Jun 2018 10:07:38 -0700 (PDT) MIME-Version: 1.0 References: <1530239363-2356-1-git-send-email-hejianet@gmail.com> <1530239363-2356-3-git-send-email-hejianet@gmail.com> In-Reply-To: <1530239363-2356-3-git-send-email-hejianet@gmail.com> From: Pavel Tatashin Date: Fri, 29 Jun 2018 13:07:02 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 2/6] mm: page_alloc: remain memblock_next_valid_pfn() on arm/arm64 To: hejianet@gmail.com Cc: linux@armlinux.org.uk, Andrew Morton , Michal Hocko , Catalin Marinas , Mel Gorman , will.deacon@arm.com, mark.rutland@arm.com, hpa@zytor.com, Daniel Jordan , AKASHI Takahiro , Gioh Kim , Steven Sistare , neelx@redhat.com, erosca@de.adit-jv.com, Vlastimil Babka , LKML , Linux Memory Management List , james.morse@arm.com, ard.biesheuvel@linaro.org, steve.capper@arm.com, tglx@linutronix.de, mingo@redhat.com, gregkh@linuxfoundation.org, kstewart@linuxfoundation.org, pombredanne@nexb.com, Johannes Weiner , kemi.wang@intel.com, ptesarik@suse.com, yasu.isimatu@gmail.com, aryabinin@virtuozzo.com, nborisov@suse.com, Wei Yang , jia.he@hxt-semitech.com Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8939 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=944 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806290182 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 10:30 PM Jia He wrote: > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But it causes > possible panic bug. So Daniel Vacek reverted it later. > > But as suggested by Daniel Vacek, it is fine to using memblock to skip > gaps and finding next valid frame with CONFIG_HAVE_ARCH_PFN_VALID. > > On arm and arm64, memblock is used by default. But generic version of > pfn_valid() is based on mem sections and memblock_next_valid_pfn() does > not always return the next valid one but skips more resulting in some > valid frames to be skipped (as if they were invalid). And that's why > kernel was eventually crashing on some !arm machines. Hi Jia, Is this a bug? Should we make other arches that support memblock to use memblock_is_map_memory() ? it is more expensive, but if the default is broken, maybe it makes sense to change? Thank you, Pavel