Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp356500imm; Fri, 10 Aug 2018 12:33:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxKoca2n9M5QDzdVsDtqS+LDuc0KVnK6NvRz7BKxK/klZARUD9LTWN9XLBnjpMl72H25WWy X-Received: by 2002:a63:7f16:: with SMTP id a22-v6mr7655826pgd.255.1533929633223; Fri, 10 Aug 2018 12:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533929633; cv=none; d=google.com; s=arc-20160816; b=uWTPKTjZ/CfhW631BvT1zPrH5mckw0VBUewx9Dz6l5fK+zQkQOpcfG8FitXSEhWLIs V/VxaRnmZO1AaGfg/B75fu1Qa0LWla7Px5TA5KqMpw0Tx7Ptq7vwNCM+Xqri++AEtejU 7e9S85pG00zJB4cM/JFB0IK4CTbEnD0MT1pELmUhtjLo82ZIOtVbDqjS/kUG6iZPeXcn l2+kBP+ICqzDtE6Ke5DfTaNiRgvaUvYBQpdyEoV1o7jG07oYxl41tDvlBC/FleKgYZDt UZQdfE0igf2fQdkaeLzXw5dNrZ9MeP+9Fo8NjeIeNBYMKL/6UD/p8J3Th3W5R0rdPvQH 2TLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=KdLHacgPWjfwI9r1yzRJG8hl5iQJgAW/2OAq4y8iy2Q=; b=WEN6vKPXE7ToNFfmxgTvCVmnxoVp02ECKP7JYKjhlzjsThfcQjZyk0G66xviF8tMHC esgVkdjX0FnKyanqhcjU40z+FH7SJWQ4wjGw7mrxWR0kzMGmP9+NzHk3+698l0pvY8px vgqFAwrTeqrhUHLdifJUYDrOdV3PTSoR9HnHJ/aKGMsLe+1/HrPby7JwRbo2Ya+TgGyA ufCg1hSnkaG942h0jKLlGxs/v59kCSnMzu8ygw3UY+2ZGDIXFweGljceT/Eh2isGfqq6 HVPGBd8vxVUBqAWAsf5dtnpJL1tc04z5qdlEjSD0THJXiMcuEqP0MHkrT13lRccygucK 2LPQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18-v6si10168747pgg.225.2018.08.10.12.33.37; Fri, 10 Aug 2018 12:33:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbeHJWDy (ORCPT + 99 others); Fri, 10 Aug 2018 18:03:54 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51871 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbeHJWDx (ORCPT ); Fri, 10 Aug 2018 18:03:53 -0400 Received: by mail-wm0-f68.google.com with SMTP id y2-v6so2998803wma.1 for ; Fri, 10 Aug 2018 12:32:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KdLHacgPWjfwI9r1yzRJG8hl5iQJgAW/2OAq4y8iy2Q=; b=GfRpqr6ZlutKNOPsYZd68TqHYBGW4bWr36xo0oA4MbL6Rzz7dPNquZXXP8dz5UIM2I 9elPsDVq0Tw8j86bTMdWQrSJv1YShNHwR+GcKywatTMjvLkQrB/35ZZmFi8lHmsk9Otw IRcJ9xmsx3EZVsTPgnOS8wlnVOLm255J2O6uUtYLm0qLYUcifSrXhXhJ/6AOVpqg2A56 637y9Y8GMA2xSi7zMSJ4MuDRf8whwm3RxmY7ELfDxqtWy7OYM+ryBHxBmsv94QR971qr clFfvZ+S1ttHglo4mKJ9CWdmsWg1MzFCgJFl9e4Gy3Hh2lH3sllhSTRRRTYqQwocxjqS /nnw== X-Gm-Message-State: AOUpUlG2H7wb0EigmqfpPMatNz0VXRGpT9qtx3KOE5LIgXusbI/eJm9v K1P3aeiKhB9x5IOn6WdGeRM= X-Received: by 2002:a1c:63d4:: with SMTP id x203-v6mr2283395wmb.9.1533929559222; Fri, 10 Aug 2018 12:32:39 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id j133-v6sm4453400wmd.12.2018.08.10.12.32.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 12:32:38 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id D3B7D12482B; Fri, 10 Aug 2018 21:32:37 +0200 (CEST) Date: Fri, 10 Aug 2018 21:32:37 +0200 From: Oscar Salvador To: Rashmica Gupta Cc: Michal Hocko , Andrew Morton , toshi.kani@hpe.com, tglx@linutronix.de, bp@suse.de, brijesh.singh@amd.com, thomas.lendacky@amd.com, jglisse@redhat.com, gregkh@linuxfoundation.org, baiyaowei@cmss.chinamobile.com, dan.j.williams@intel.com, iamjoonsoo.kim@lge.com, Vlastimil Babka , malat@debian.org, Bjorn Helgaas , yasu.isimatu@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: Re: [PATCH v3] resource: Merge resources on a node when hot-adding memory Message-ID: <20180810193237.GA22441@techadventures.net> References: <20180809025409.31552-1-rashmica.g@gmail.com> <20180809181224.0b7417e51215565dbda9f665@linux-foundation.org> <20180810130052.GC1644@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 11, 2018 at 12:25:39AM +1000, Rashmica Gupta wrote: > On Fri, Aug 10, 2018 at 11:00 PM, Michal Hocko wrote: > > On Fri 10-08-18 16:55:40, Rashmica Gupta wrote: > > [...] > >> Most memory hotplug/hotremove seems to be block or section based, and > >> always adds and removes memory at the same place. > > > > Yes and that is hard wired to the memory hotplug code. It is not easy to > > make it work outside of section units restriction. So whatever your > > memtrace is doing and if it relies on subsection hotplug it cannot > > possibly work with the current code. > > > > I didn't get to review your patch but if it is only needed for an > > unmerged code I would rather incline to not merge it unless it is a > > clear win to the resource subsystem. A report from Oscar shows that this > > is not the case though. > > > > Yup, makes sense. I'll work on it and see if I can not break things. In __case__ we really need this patch, I think that one way to fix this is to only call merge_node_resources() in case the node is already online. Something like this (completely untested): +struct resource *request_resource_and_merge(struct resource *parent, + struct resource *new, int nid) +{ + struct resource *conflict; + + conflict = request_resource_conflict(parent, new); + + if (conflict) + return conflict; + +#ifdef CONFIG_MEMORY_HOTREMOVE + /* We do not need to merge any resources on a node that is being + * hot-added together with its memory. + * The node will be allocated later. + */ + if (node_online(nid)) + merge_node_resources(nid, parent); +#endif /* CONFIG_MEMORY_HOTREMOVE */ Although as Michal said, all memory-hotplug code is section-oriented, so whatever it is that interacts with it should expect that. Otherwise it can fail soon or later. -- Oscar Salvador SUSE L3