Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2118265pxb; Fri, 8 Oct 2021 00:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEUGLJ75aZaKNSNZHHrBU7P6nB4tuWPDfLzaNkaN+FT1dfwnIVCz6wMctTJKgaDqAN08oI X-Received: by 2002:a17:90a:e38f:: with SMTP id b15mr10406380pjz.76.1633679611265; Fri, 08 Oct 2021 00:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633679611; cv=none; d=google.com; s=arc-20160816; b=seeCHHcGA9zP4kDaTkbSLSIJKs/rL+pi2H4hDjQUmX7J355sLXvq7Zb5M401qNquzX kjSyTPvbnjimQBUQKST3JM0CAbI6h7yBh8BiUIeGfYd+hrYaojC4yiAPxA8e5O3o2KYH ERtcWPJlHqFEmaDT06V6gWYWMgUDxEDPOSp+oQoqd2R8zEB1UQ/t+A7zQYF2OMa68omA aqbWnGkANX0M4I3CU5Teof+/ZCOJ6VbjptCLk51ivYVaSzWVEd9eKwZxS/90Ey4pUjcn HTcwjeBpNdtR5WXXkoVM1H5s+1OAwHE7LeJg5w3P4blTLXFePmkIm0IvDZOBYkdns78b uvrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=EOrO/y2fMgV1Ja1dD+8lPp0L19uK5f6z18Da2kjk2yQ=; b=XEEmL16X6nw2kgUySNRPRm4MeRQYfQ6eE425Xlxg/dOSGcGbXh7tU9LqCTfcnx94IX pT/vSdtyzraNWXI0XVNfO+O+PQJ7/BDagdWzD9elzQNhnwCrNkDgeN+ixtxSzNdeSEck 80lnrWSwhF687wuTqz8EXoLZTvlKQYc64ehEEfk2dYl0SMBddmDRQWXmV+mPnWHScsJT 3kJLxWcBYnkEglyEDlW8HiUUYSM1jdP0D/rWhLwk37C6IyJq/uP6EaLEGMTJbDbQHOiZ iNnXNUwu2OUPn5l+USuiI/QcnHMXvjXafCbQuHIpKyr/hETv0hQceQXldKGosuQZYyVh BCKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=imGUG8Sq; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=UZ0Qkix4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t13si2129663pgk.215.2021.10.08.00.53.17; Fri, 08 Oct 2021 00:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=imGUG8Sq; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=UZ0Qkix4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231749AbhJHHw7 (ORCPT + 99 others); Fri, 8 Oct 2021 03:52:59 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:38522 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbhJHHw6 (ORCPT ); Fri, 8 Oct 2021 03:52:58 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EE90521D6C; Fri, 8 Oct 2021 07:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633679462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EOrO/y2fMgV1Ja1dD+8lPp0L19uK5f6z18Da2kjk2yQ=; b=imGUG8SqVGc7Dz6yptaCglkipl90+lZ1xYMYRBBrROVm0qU0I0o0Gs8Dj6plkiUWaEQQG+ HA4sstusX3KtXMOoJqx08gr6qmnFUJD9Z5X0oopHveCOoJzPZuEMEQ3fFJ/BQ6c3QJKs0W 2O8Z4iicadz+oX4yBpbSdv/FLPOcik0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633679462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EOrO/y2fMgV1Ja1dD+8lPp0L19uK5f6z18Da2kjk2yQ=; b=UZ0Qkix4kWei1UbY0PlKmtrfZD+5sasCBp8MvgZsEl+5LlvbCZlL1vog0FyNaXnOejAcVm ENUPWpQavue8NJCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2911813D36; Fri, 8 Oct 2021 07:51:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TJJ+Bmb4X2FFVAAAMHmgww (envelope-from ); Fri, 08 Oct 2021 07:51:02 +0000 Date: Fri, 8 Oct 2021 09:51:00 +0200 From: Oscar Salvador To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Michal Hocko , Zi Yan , Muchun Song , Naoya Horiguchi , David Rientjes , "Aneesh Kumar K . V" , Nghia Le , Andrew Morton Subject: Re: [PATCH v4 1/5] hugetlb: add demote hugetlb page sysfs interfaces Message-ID: References: <20211007181918.136982-1-mike.kravetz@oracle.com> <20211007181918.136982-2-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211007181918.136982-2-mike.kravetz@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 07, 2021 at 11:19:14AM -0700, Mike Kravetz wrote: > +static ssize_t demote_store(struct kobject *kobj, > + struct kobj_attribute *attr, const char *buf, size_t len) > +{ > + unsigned long nr_demote; > + unsigned long nr_available; > + nodemask_t nodes_allowed, *n_mask; > + struct hstate *h; > + int err = 0; > + int nid; > + > + err = kstrtoul(buf, 10, &nr_demote); > + if (err) > + return err; > + h = kobj_to_hstate(kobj, &nid); > + > + /* Synchronize with other sysfs operations modifying huge pages */ > + mutex_lock(&h->resize_lock); > + > + if (nid != NUMA_NO_NODE) { > + init_nodemask_of_node(&nodes_allowed, nid); > + n_mask = &nodes_allowed; > + } else { > + n_mask = &node_states[N_MEMORY]; > + } Why this needs to be protected by the resize_lock? I do not understand what are we really protecting here and from what. Besides that, I did not spot anything wrong. -- Oscar Salvador SUSE Labs