Return-Path: Received: from ivanoab6.miniserver.com ([5.153.251.140] helo=www.kot-begemot.co.uk) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfNhI-0007aI-2o for linux-um@lists.infradead.org; Fri, 04 Jan 2019 11:31:29 +0000 Subject: Re: [PATCH] um: Try to avoid kmalloc in signal handling References: <20190104100517.9809-1-anton.ivanov@cambridgegreys.com> <2157515.SUgOQPs8Ts@blindfold> <108ad3b6-93ee-5d8c-c1bf-b83e22ff3d3f@cambridgegreys.com> <9157944.H6u4diqB1j@blindfold> From: Anton Ivanov Message-ID: <4c1000e7-adb7-eb24-b7a4-e2977f30bdff@cambridgegreys.com> Date: Fri, 4 Jan 2019 11:31:22 +0000 MIME-Version: 1.0 In-Reply-To: <9157944.H6u4diqB1j@blindfold> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Richard Weinberger Cc: linux-um@lists.infradead.org On 1/4/19 10:33 AM, Richard Weinberger wrote: > Am Freitag, 4. Januar 2019, 11:19:46 CET schrieb Anton Ivanov: >>> I fear this is not correct. >>> Think of task switching, if you push something to reg_file[], >>> it is not guaranteed that the same task will run next and pop the item. >>> The order can change. >> >> It should not occur for the signals that map onto IRQ (timer and IO) - >> there it is all kernel. >> >> I cannot trigger that for the other ones, but it may be possible. > > We need to be super sure about this. > >> IMO we should just bite the bullet and go back to using the stack >> increasing the minimum stack order needed to 1 for 32 bit and to 2 for >> 64 bit. > > Increasing the kernel stack just for this is also a huge overhead. > But I never benchmarked it myself. I just did. I wrote a quick alternative to put it back on the stack. Stack is marginally ~ 1% or thereabouts faster than the data segment patch on network tests. That makes it 14% faster than kmalloc-ing the pt_regs in the signal handling path. The difference for other stuff (disk, etc) is within statistical error. It is indeed using more stack - the minimum stack order needed for my setup on 64 bit is now 2 (On AMD A12). > >> x86 if I read it correctly is still using the stack even for the new >> register sets. > > Are you sure? I don't think so. The kernel stack is small and the xregset is > huge. > Where did you see this? > > Thanks, > //richard > > > -- Anton R. Ivanov Cambridge Greys Limited, England and Wales company No 10273661 http://www.cambridgegreys.com/ _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um