Received: by 10.223.176.5 with SMTP id f5csp4092003wra; Tue, 30 Jan 2018 01:55:03 -0800 (PST) X-Google-Smtp-Source: AH8x227dRJgzDwgMRn8MqVKuXGqeBC/W7bubWnTwDV6MoC2VpY13YggZH/ePv6KMVPxt5Kw3r1AI X-Received: by 2002:a17:902:b43:: with SMTP id 61-v6mr25051601plq.127.1517306103867; Tue, 30 Jan 2018 01:55:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517306103; cv=none; d=google.com; s=arc-20160816; b=dYIO5J5dy6VybjOY2Bz8xgHjyxtVvuRLMc/ktz7IT/jiiKMyMOdNmGczui+uBb+aSX wm65lITo0QnlLQnZpcnFCcwRxMCLPRlczERTPcoBHjDrfXY7bhDMrZWnkwixNWVaqm6l XSLx7jb4ZhmD/xse6EFenPGTRX13o6pZUV3AGDUzElYeCeApYuF7wAhD0UTRGaWCGU7U lMQWnHRn12hFJ/G/BvKtvnOe2XFB/f5W4968VZHSbjIQWCqAsjbUifzjM9odnZxcJosh 7/cRGzhC0QA2A76KqFALRkCugtu4u64WR/WLH8J5uBMPz0bSm/ObjbbWCiK4GlK2d6H5 HRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=yVkyT8V3wFOdqQGYCDehLqT1EkAODvVNiPHEPtnP0tM=; b=r2jbpXEzog4EPanmUg+fyipZWh0Tpo+Zbm6syffpHtd4UyaC/1t3eA9OfKFf3Kux+d yefgX0Vnjoj6Yj/NUpOEePrFwglYqrDvBrEm9RvD24DI/etwYfaXsaQmPfddEfUc528Q RWArpwCM+bv3dGUFISAI464KMme3LAq/R83tdOdQSgSWByV5sQCd2l9xBs9BLXhZVK7T N14vcqWS67zvHMIxLVfq9cyuD8gV4N7+q/kzGfCgd/Py4VObgbvx2BPDkPmN5tKcs6j9 I5lVD6l8TvL+UVdnSIvVtxdA5s55uj3PzGrnzJ4GhjckWW8EhZHHm02PDFzmiySyO9ps Srjg== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e32-v6si1249622plb.34.2018.01.30.01.54.49; Tue, 30 Jan 2018 01:55:03 -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; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbeA3Jx5 (ORCPT + 99 others); Tue, 30 Jan 2018 04:53:57 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50932 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751273AbeA3Jxz (ORCPT ); Tue, 30 Jan 2018 04:53:55 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0U9oQKV144548 for ; Tue, 30 Jan 2018 04:53:55 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ftn9nb1bd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 Jan 2018 04:53:54 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Jan 2018 09:53:51 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Jan 2018 09:53:49 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0U9rnVL459218; Tue, 30 Jan 2018 09:53:49 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54C4042045; Tue, 30 Jan 2018 09:46:57 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 89C844203F; Tue, 30 Jan 2018 09:46:56 +0000 (GMT) Received: from in.ibm.com (unknown [9.124.35.20]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 30 Jan 2018 09:46:56 +0000 (GMT) Date: Tue, 30 Jan 2018 15:23:45 +0530 From: Bharata B Rao To: Michal Hocko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, pasha.tatashin@oracle.com Subject: Re: Memory hotplug not increasing the total RAM Reply-To: bharata@linux.vnet.ibm.com References: <20180130083006.GB1245@in.ibm.com> <20180130091600.GA26445@dhcp22.suse.cz> <20180130092815.GR21609@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180130092815.GR21609@dhcp22.suse.cz> User-Agent: Mutt/1.7.1 (2016-10-04) X-TM-AS-GCONF: 00 x-cbid: 18013009-0040-0000-0000-0000042A5E97 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18013009-0041-0000-0000-000020CDF649 Message-Id: <20180130095345.GC1245@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-30_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801300127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 30, 2018 at 10:28:15AM +0100, Michal Hocko wrote: > On Tue 30-01-18 10:16:00, Michal Hocko wrote: > > On Tue 30-01-18 14:00:06, Bharata B Rao wrote: > > > Hi, > > > > > > With the latest upstream, I see that memory hotplug is not working > > > as expected. The hotplugged memory isn't seen to increase the total > > > RAM pages. This has been observed with both x86 and Power guests. > > > > > > 1. Memory hotplug code intially marks pages as PageReserved via > > > __add_section(). > > > 2. Later the struct page gets cleared in __init_single_page(). > > > 3. Next online_pages_range() increments totalram_pages only when > > > PageReserved is set. > > > > You are right. I have completely forgot about this late struct page > > initialization during onlining. memory hotplug really doesn't want > > zeroying. Let me think about a fix. > > Could you test with the following please? Not an act of beauty but > we are initializing memmap in sparse_add_one_section for memory > hotplug. I hate how this is different from the initialization case > but there is quite a long route to unify those two... So a quick > fix should be as follows. Tested on Power guest, fixes the issue. I can now see the total memory size increasing after hotplug. Regards, Bharata.