From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788AbbGKKCg (ORCPT ); Sat, 11 Jul 2015 06:02:36 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:44526 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753426AbbGKKCf (ORCPT ); Sat, 11 Jul 2015 06:02:35 -0400 Date: Sat, 11 Jul 2015 03:02:32 -0700 From: Christoph Hellwig To: Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH 0/2] mm/shrinker: make unregister_shrinker() less fragile Message-ID: <20150711100232.GA4607@infradead.org> References: <1436583115-6323-1-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436583115-6323-1-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2015 at 11:51:53AM +0900, Sergey Senozhatsky wrote: > Hello, > > Shrinker API does not handle nicely unregister_shrinker() on a not-registered > ->shrinker. Looking at shrinker users, they all have to > (a) carry on some sort of a flag to make sure that "unregister_shrinker()" > will not blow up later > (b) be fishy (potentially can Oops) > (c) access private members `struct shrinker' (e.g. `shrink.list.next') Ayone who does that is broken. You just need to have clear init (with proper unwinding) and exit functions and order things properly. It works like most register/unregister calls and should stay that way. Maye you you should ty to explain what practical problem you're seeing to start with.