Received: by 10.223.185.116 with SMTP id b49csp4292332wrg; Tue, 6 Mar 2018 13:10:34 -0800 (PST) X-Google-Smtp-Source: AG47ELs/lOd5w85nQuz+9Ew2KkJX3Qjnv8lTPI47BzxQPfYP2/ZcN1MUWSvZ+oG07ZxftJH5PcH+ X-Received: by 10.99.105.70 with SMTP id e67mr16147526pgc.342.1520370634721; Tue, 06 Mar 2018 13:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520370634; cv=none; d=google.com; s=arc-20160816; b=CvfniSSWCtCUuUVD2CNxnTvH87vggtSagMJ4RKrS/1zE8Egoexi0CENIUWQ2n2nOlQ iOQPHG3e9qmuk5ungqQ3BhO3o8hexml111ZeynnCQMyU4ba+9BzxyIvEa/GnmozMhlem bbRlJ85YyPcDLD6mI9YJjnxhfnAg9LWOWbNg6vIueoVu7QTtnq20wzDrbWJXmB3UNT6w qoFK4fDV6lvU35bHpEJFc+BQdWFrTIBDd7VHcUY2mf73SBOT78fzDKLhAMN3b+fhCHw1 wvhRraK9hTsVtM5Qsdjh9TWWbfNe5uu9XwpGc4h50mdU9nHTYHrBDV2Ml3BYAj+thupm uBEg== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=NOnrT9sWOD5Kk+r8oM+T2dvGdxBnN+O6wfqiz9aNuNA=; b=iCBPOEyObWKACSPxld0tQzQ5f/KzYa8mpPxxeqJ0anr+IGA/ieEWLG6a2xfVE56pDD 519rQJMdlQU37NMZhuOEidPyJ4AXWkxqd0wknG+8kCU9T4Kwee9NEqi5AYMW8eC8EpT7 xq6AxH60qqUurfEEcuOe7YHAM78/yKIzzz/nox+NpW8CU8PPg4kYSJZNP4okzVuJWLtP BNxQTGXvZMmgz09AjAjjYXMQClpclSCiRMsjC5hHESI5nCfScfI2PJoS46j38dy6cQPw ZhWEwItJL/nKy2CstIcx3pmLcXYDnaemSrTJ/jMBZMsPT9WIpYOrayHk3oQ2/Id2OGoe 2fVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=HszRapAu; 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 w12-v6si11784725pld.51.2018.03.06.13.10.19; Tue, 06 Mar 2018 13:10:34 -0800 (PST) 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=HszRapAu; 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 S932892AbeCFVJL (ORCPT + 99 others); Tue, 6 Mar 2018 16:09:11 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51918 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753466AbeCFVJJ (ORCPT ); Tue, 6 Mar 2018 16:09:09 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w26L6geI014953 for ; Tue, 6 Mar 2018 21:09:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : in-reply-to : references : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=NOnrT9sWOD5Kk+r8oM+T2dvGdxBnN+O6wfqiz9aNuNA=; b=HszRapAuhL8pv/Ycfrfs7fbWU0+26pz2cAcTt5mNL63WB53uyTQJ2i1Tdyk25mOp/f6I 0+fLHrao2Ay7nfdr5hYfGbwB72wD/zrhSSFkQqpSU/rGZFl8lvb2V6FUz/AVUZf/fVp4 OefdsjOTqiYteCNE07Z2fO7hs/GcDGqDWf49jsMirm4zFn9fU3rxzSNYPDPsmcaaEoez 0gE+ykOAyvTKinDXT9HX0CoWsZcL4W44fMWGlpDVzLFoKWn5aFg+LIABHDF4JEw83F1g ry3PBRVDaiXSsfNY+SSh7EGuoDDzYdUR+phDN72KJ+6zGlNmEwWq2vL88gIN3IE9q4Mn TA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gj234g6qm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 06 Mar 2018 21:09:09 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w26L47bj010289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 6 Mar 2018 21:04:08 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w26L47O4016744 for ; Tue, 6 Mar 2018 21:04:07 GMT Received: from mail-oi0-f41.google.com (/209.85.218.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Mar 2018 13:04:07 -0800 Received: by mail-oi0-f41.google.com with SMTP id c12so19102oic.7 for ; Tue, 06 Mar 2018 13:04:07 -0800 (PST) X-Gm-Message-State: AElRT7H0cpnQ53YRypdIqGq0i/lnY0EeDHivLIHXKXHL+Vpc79Jr8P0S BdGJSB7dM48OEfNXXO3VJtEfeqRc/elYJ0g7fmI= X-Received: by 10.202.88.86 with SMTP id m83mr12240368oib.221.1520370246879; Tue, 06 Mar 2018 13:04:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.87.72 with HTTP; Tue, 6 Mar 2018 13:04:06 -0800 (PST) In-Reply-To: <20180306125604.c394a25a50cae0e36c546855@linux-foundation.org> References: <20180306192022.28289-1-pasha.tatashin@oracle.com> <20180306123655.957e5b6b20b200505544ea7a@linux-foundation.org> <20180306125604.c394a25a50cae0e36c546855@linux-foundation.org> From: Pavel Tatashin Date: Tue, 6 Mar 2018 16:04:06 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: might_sleep warning To: Andrew Morton Cc: Steven Sistare , Daniel Jordan , Masayoshi Mizuma , Michal Hocko , Catalin Marinas , AKASHI Takahiro , Gioh Kim , Heiko Carstens , Yaowei Bai , Wei Yang , Paul Burton , Miles Chen , Vlastimil Babka , Mel Gorman , Johannes Weiner , LKML , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8824 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=8 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060228 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > spin_lock(&deferred_zone_grow_lock); > > > > - static_branch_disable(&deferred_pages); > > > > + deferred_zone_grow = false; > > > > spin_unlock(&deferred_zone_grow_lock); > > > > + static_branch_disable(&deferred_pages); > > > > > > > > /* There will be num_node_state(N_MEMORY) threads */ > > > > atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); > > > > > > Kinda ugly, but I can see the logic behind the decisions. > > > > > > Can we instead turn deferred_zone_grow_lock into a mutex? > > (top-posting repaired. Please don't top-post). > > > [CCed everyone] > > > > Hi Andrew, > > > > I afraid we cannot change this spinlock to mutex > > because deferred_grow_zone() might be called from an interrupt context if > > interrupt thread needs to allocate memory. > > > > OK. But if deferred_grow_zone() can be called from interrupt then > page_alloc_init_late() should be using spin_lock_irq(), shouldn't it? > I'm surprised that lockdep didn't detect that. No, page_alloc_init_late() cannot be called from interrupt, it is called straight from: kernel_init_freeable(). But, I believe deferred_grow_zone(): can be called: get_page_from_freelist() _deferred_grow_zone() deferred_grow_zone() > > > > --- a/mm/page_alloc.c~mm-initialize-pages-on-demand-during-boot-fix-4-fix > +++ a/mm/page_alloc.c > @@ -1689,9 +1689,9 @@ void __init page_alloc_init_late(void) > * context. Since, spin_lock() disables preemption, we must use an > * extra boolean deferred_zone_grow. > */ > - spin_lock(&deferred_zone_grow_lock); > + spin_lock_irq(&deferred_zone_grow_lock); > deferred_zone_grow = false; > - spin_unlock(&deferred_zone_grow_lock); > + spin_unlock_irq(&deferred_zone_grow_lock); > static_branch_disable(&deferred_pages); > > /* There will be num_node_state(N_MEMORY) threads */ > _ > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org