From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by kanga.kvack.org (Postfix) with ESMTP id 0F2E36B0038 for ; Tue, 3 Mar 2015 05:37:39 -0500 (EST) Received: by pdbnh10 with SMTP id nh10so23843330pdb.3 for ; Tue, 03 Mar 2015 02:37:38 -0800 (PST) Received: from heian.cn.fujitsu.com ([59.151.112.132]) by mx.google.com with ESMTP id fn7si392415pdb.157.2015.03.03.02.37.37 for ; Tue, 03 Mar 2015 02:37:38 -0800 (PST) Message-ID: <54F58AE3.50101@cn.fujitsu.com> Date: Tue, 3 Mar 2015 18:20:19 +0800 From: Gu Zheng MIME-Version: 1.0 Subject: Re: node-hotplug: is memset 0 safe in try_offline_node()? References: <54F52ACF.4030103@huawei.com> In-Reply-To: <54F52ACF.4030103@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org List-ID: To: Xishi Qiu Cc: Yasuaki Ishimatsu , Andrew Morton , Tang Chen , Yinghai Lu , Linux MM , LKML , Toshi Kani , Mel Gorman , Tejun Heo Hi Xishi, On 03/03/2015 11:30 AM, Xishi Qiu wrote: > When hot-remove a numa node, we will clear pgdat, > but is memset 0 safe in try_offline_node()? It is not safe here. In fact, this is a temporary solution here. As you know, pgdat is accessed lock-less now, so protection mechanism (RCU=EF=BC=9F) is needed to make it completely safe here, but it seems a bit over-kill. >=20 > process A: offline node XX: > for_each_populated_zone() > find online node XX > cond_resched() > offline cpu and memory, then try_offline_node() > node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat)) > access node XX's pgdat > NULL pointer access error It's possible, but I did not meet this condition, did you? Regards, Gu >=20 > Thanks, > Xishi Qiu >=20 > -- > 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 >=20 -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756220AbbCCKhl (ORCPT ); Tue, 3 Mar 2015 05:37:41 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:50670 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755440AbbCCKhi convert rfc822-to-8bit (ORCPT ); Tue, 3 Mar 2015 05:37:38 -0500 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="61952002" Message-ID: <54F58AE3.50101@cn.fujitsu.com> Date: Tue, 3 Mar 2015 18:20:19 +0800 From: Gu Zheng User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: Xishi Qiu CC: Yasuaki Ishimatsu , Andrew Morton , Tang Chen , Yinghai Lu , Linux MM , LKML , Toshi Kani , Mel Gorman , Tejun Heo Subject: Re: node-hotplug: is memset 0 safe in try_offline_node()? References: <54F52ACF.4030103@huawei.com> In-Reply-To: <54F52ACF.4030103@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.167.226.100] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Xishi, On 03/03/2015 11:30 AM, Xishi Qiu wrote: > When hot-remove a numa node, we will clear pgdat, > but is memset 0 safe in try_offline_node()? It is not safe here. In fact, this is a temporary solution here. As you know, pgdat is accessed lock-less now, so protection mechanism (RCU?) is needed to make it completely safe here, but it seems a bit over-kill. > > process A: offline node XX: > for_each_populated_zone() > find online node XX > cond_resched() > offline cpu and memory, then try_offline_node() > node_set_offline(nid), and memset(pgdat, 0, sizeof(*pgdat)) > access node XX's pgdat > NULL pointer access error It's possible, but I did not meet this condition, did you? Regards, Gu > > Thanks, > Xishi Qiu > > -- > 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 >