Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3791949imu; Tue, 18 Dec 2018 04:21:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/XcFwOHLnbHmUEKZO/Z/oJdgVLeY2ynzGrFFxJw7EPinOn7Rv+1+zCCif4K2SiSg4bKtXh4 X-Received: by 2002:a63:413:: with SMTP id 19mr3080490pge.7.1545135681791; Tue, 18 Dec 2018 04:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545135681; cv=none; d=google.com; s=arc-20160816; b=CYocMnqJzsRmcDK5lbPOm5PfEIoGTEaL5704aJ29Pl2UF8F6FMQe+OjHy0ZevNTTsv ZoXnt57RXPgsnB5XC3Z+hZXbcDkMNbZ4P8zo/8+64ActNqKbNl1cBmzreI/em3nKfPOi 2/Cd0D0EABR67W2Z/WoGlyWwfjoUuT/0I2YmeOFb23X92lhnjf2BmVX+1dIA/oxTrbQO hV6qRb7aqRgVynT0FPDqR3DLaEDu0y6uYpNZR5f/x/zK3njHUn61ku0QD3u5K2W1LjBK CaDhHPBJRVlDbQbfaiH1mQn2ZM4Tgv0Vld975HtkEpIkpvhYTqfkHVndhSAlvpnxfNpo pawg== 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; bh=zAz3r8fUWhwp0OU4se1PupriFhQWLCtjsqFbMZhzRhU=; b=wwZ/JgtYtonO4A6k/Z/0nZrj31FNJMhvatMUALXScwqsV28AU3+4AGIv+irtWKO04I o87J8sltFECYL4YHA+5zO6wqW4xPriQyFF9mrgo+KAu6bWKArphsY7vearw5cxL1jTXP mBwXCCNp02nmGQCH428u1HVPRobthcB3x9BZRCX56nQvIcu+c55z777ZGPYwDziMhxc0 ZCV9/A4HECOYAiQ/mrHMYk+R5+nPgvYAumaWgvD4WIf9oQER4ZgvWE87lZR2l7k+ptGw 5WHFBi08fOXZjhsXeDgZlEljwQUjcvRc7JeOGxz5V3Ge9FUCS6Qf3RZxfByjvjhr3OE7 E7ag== 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 z5si13122250pgj.177.2018.12.18.04.21.06; Tue, 18 Dec 2018 04:21:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726698AbeLRMTs (ORCPT + 99 others); Tue, 18 Dec 2018 07:19:48 -0500 Received: from charlotte.tuxdriver.com ([70.61.120.58]:48953 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbeLRMTr (ORCPT ); Tue, 18 Dec 2018 07:19:47 -0500 Received: from cpe-2606-a000-111b-405a-a193-cb97-58ba-1c15.dyn6.twc.com ([2606:a000:111b:405a:a193:cb97:58ba:1c15] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1gZELb-0005zt-8L; Tue, 18 Dec 2018 07:19:42 -0500 Date: Tue, 18 Dec 2018 07:19:12 -0500 From: Neil Horman To: Kent Overstreet Cc: Matthew Wilcox , Xin Long , LKML , dave.hansen@intel.com, davem , Oleg Babin , Konstantin Khorenko Subject: Re: [PATCH 6/6] Drop flex_arrays Message-ID: <20181218121912.GA2078@hmswarspite.think-freely.org> References: <20180907165635.8469-1-kent.overstreet@gmail.com> <20180907165635.8469-7-kent.overstreet@gmail.com> <20181213144111.GO6830@bombadil.infradead.org> <20181213155149.GA4127@hmswarspite.think-freely.org> <20181213164533.GQ6830@bombadil.infradead.org> <20181213180917.GB4127@hmswarspite.think-freely.org> <20181217125011.GA28294@kmo-pixel> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181217125011.GA28294@kmo-pixel> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 17, 2018 at 07:50:11AM -0500, Kent Overstreet wrote: > On Thu, Dec 13, 2018 at 01:09:17PM -0500, Neil Horman wrote: > > On Thu, Dec 13, 2018 at 08:45:33AM -0800, Matthew Wilcox wrote: > > > On Thu, Dec 13, 2018 at 10:51:49AM -0500, Neil Horman wrote: > > > > On Thu, Dec 13, 2018 at 06:41:11AM -0800, Matthew Wilcox wrote: > > > > > On Thu, Dec 13, 2018 at 09:30:47PM +0900, Xin Long wrote: > > > > > > On Sat, Sep 8, 2018 at 1:57 AM Kent Overstreet > > > > > > wrote: > > > > > > > > > > > > > > All existing users have been converted to generic radix trees > > > > > > NAK, SCTP is still using flex_arrays, > > > > > > # grep flex_array net/sctp/* > > > > > > > > > > > > This patch will break the build. > > > > > > > > > > sctp added that user after this patch was sent. Please stop adding > > > > > flexarray users! > > > > > > > > > > This particular user should probably have just used kvmalloc. > > > > > > > > > > > > > No, I don't think thats right. > > > > > > > > This appears to have been sent on September 7th. Commit > > > > 0d493b4d0be352b5e361e4fa0bc3efe952d8b10e, which added the use of flex_arrays to > > > > sctp, seems to have been merged on August 10th, a month prior. > > > > > > Are you seriously suggesting anybody sending cleanups needs to be > > > monitoring every single email list to see if anybody has added a new user? > > > Removing the flexarray has been advertised since May. > > > https://lkml.org/lkml/2018/5/22/1142 > > > > > I don't see how thats any more egregious than everyone else having to monitor > > for removals of code thats in the tree at some indeterminate future. The long and the short of it > > is that a new flex_array user was added in the intervening 7 months that this > > patch has been waiting to go in, and it will now break if merged. I'm sorry we > > started using it during that time, but it got missed by everyone in the chain > > that merged it, and hasn't been noticed in the 4 months since. It is what it > > is, and now it needs to be undone. > > > > > > regardless, however, sctp has a current in-tree use of flex_arrays, and merging > > > > this patch will break the build without a respin. > > > > > > Great. I await your patch to replace the flexarray usage. > > Sure, we'll get to it as soon as we can, or, if you are in a hurry, you can > > replace the same usage, like you've done for all the other users in this series. > > This is really my fault for slacking on getting generic-radix-trees in, and > given that the sctp code has been merged I'll do the conversion. > Thank you, I appreciate that. > However. > > Looking at the sctp code, honestly, wtf is going on here. > > sctp_send_add_streams() calls sctp_stream_alloc_out() when it wants to make the > out flex_array bigger - ok, this makes sense, you're using a flex_array because > you want something resizable. > > But wait, look what it actually does - it unconditionally frees the old flex > array and preallocates a new one and copies the contents of the old one over. > > Without, as far as I can tell, any locking whatsoever. > > Was this code tested? Reviewed? > Yup, both sides are protected by the socket lock for which the sctp connection is associated. Its locked in the sctp_setsockopt function, which is the path through which we update/reallocate these flex arrays, and its also locked on transmit in sctp_sendmsg, and on receive in sctp_rcv (via bh_lock_sock) Neil