Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1032421ybl; Sat, 18 Jan 2020 17:06:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzOkLUJp3P0qYf97/0qPM8zBndafTsL1MdZG7UNLSh+76q9P4oWBomJIh0iRWXYaJIMrIko X-Received: by 2002:aca:bbc6:: with SMTP id l189mr8769393oif.53.1579396014752; Sat, 18 Jan 2020 17:06:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579396014; cv=none; d=google.com; s=arc-20160816; b=A+T89UbJ/aahg+QWa+9QgY3En7xUEQSpCr4aOLLRTdXwVAD8izA8XqZMJJo0OfSJyB D9MMxVGHPJTYuKHG7GZDQqQj1LUNrrZvpNQLRvF/5XwQxcV4nr3ojJ++cMVNyLONBscr iRHr6eX+j4eTDjZsdzdbfFFTkgZK8tQOR/l0Os7is0jFVvjBfWmPkLUR5vfleJnE0b93 cSFCi0LoQ3i3l2WiDUq+d7GCs5Fl6b2LhXr/12hf1jT42GNDIH6maiumLRQMUxEuhnnP MCxYJXDcH3tilnVwpayy9fBbEmFuYf+faUWrVbhB8j/In9VoigftmCXTJn1Um0q+kFYv 0d/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4STAXl1TISpJHUSG1YvZBNtnRMty+Id9v6xXxnG/aWw=; b=c99Mzz767/qc/W7sx1Z6/ZfnBbUA35PG1cHOoQbOqNK7TftKVz9NB+tTcgljsewQgv OqbvI39pw/wNt2JS4f5P82M/x1801HA9MOzt8mn4VN2fK58tmpDeG6l/HYpkp/BF4dy2 dASBZYSJDx5bIgLdiysYVkXHKQfT4jXzpeTRQHHm4+NzwZh3RrG07w/hLbcygyQilQCv xT1oGJh5M0khDmT2OQFR8oPGmbBbp8XIvHkNAgUgr1+GxbTVTwzIqz4I4EP7IYfNEhvB 7HtExMvU8A8tJNFxVC/MIlhRnablUMyLeFys1cQMCiXNN/faBM9Vu7CVSD4avbcAmDIu nswg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0C41Sgqm; 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 g17si17939184otk.252.2020.01.18.17.06.42; Sat, 18 Jan 2020 17:06:54 -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=@kernel.org header.s=default header.b=0C41Sgqm; 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 S1727325AbgASBEq (ORCPT + 99 others); Sat, 18 Jan 2020 20:04:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:41450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbgASBEq (ORCPT ); Sat, 18 Jan 2020 20:04:46 -0500 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C2FC2467C; Sun, 19 Jan 2020 01:04:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579395885; bh=UC0MjXqTZ9KKw7ixKrMeXOzVZ+e+F/FydRb0OQ8QP+g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0C41Sgqmz28bOgjI6zFREqdPrxnbdmnXsjiXKjgOY4EOwLy+sAGGhFK+nheXzCOcK NfWt2L1hPIUYO2rEUJYVaL7vURlzvXAHqLNjix1AoWw+AdwlTNd+vxikG7MSE839Ia NL1FH+8f2Z7icJoxxWsEDLFMsIH1Njrifecy2OTk= Date: Sat, 18 Jan 2020 17:04:45 -0800 From: Andrew Morton To: David Rientjes Cc: Vlastimil Babka , Mel Gorman , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch v2] mm, thp: fix defrag setting if newline is not used Message-Id: <20200118170445.370d908ce29f42068390addb@linux-foundation.org> In-Reply-To: References: <20200116191609.3972fd5301cf364a27381923@linux-foundation.org> <025511aa-4721-2edb-d658-78d6368a9101@suse.cz> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Jan 2020 14:11:48 -0800 (PST) David Rientjes wrote: > If thp defrag setting "defer" is used and a newline is *not* used when > writing to the sysfs file, this is interpreted as the "defer+madvise" > option. > > This is because we do prefix matching and if five characters are written > without a newline, the current code ends up comparing to the first five > bytes of the "defer+madvise" option and using that instead. > > Use the more appropriate sysfs_streq() that handles the trailing newline > for us. Since this doubles as a nice cleanup, do it in enabled_store() > as well. I can't really I really understand this prefix-matching thing that we're taking away. Documentation/admin-guide/mm/transhuge.rst doesn't appear to mention it. Could we please add a paragraph to the changelog to spell all this out. Bonus points for formally describing the behaviour which we're removing! Thanks.