Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3685998yba; Tue, 7 May 2019 05:34:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1p9m3hpy7aB7byUoULEoIexZygr2CCk+EXseB7dSOc+PWDV1ubXa6NvJgXkTc7YsPHSLq X-Received: by 2002:aa7:8083:: with SMTP id v3mr42022776pff.135.1557232448556; Tue, 07 May 2019 05:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557232448; cv=none; d=google.com; s=arc-20160816; b=g2hgZ6XJLfkuTtReJiV6sQohpEF/wrTCs2vlHST3K7gZboZqC5uy31ctL1XYQfsJRL LI3qAO/Uvhz8OuMFOPonuuCYNb9XoNDPLUryHPjXZGkA6zMMGTIge4hBPaN3DspyUobq zLlzgeymGAw8e8FQ05r7NKwAHa1hzcd8Gf93HKVA66vo8vdr5qCUme8z3t9Ai+j5qSvP gf1td+3OrabEUwAcvltj1G7cTzenj2+LRGRwwYvjEP0JpH+R6A0OGR03TNSrs0rITeox ha+NoJDJFMhmtWmL0elUAbDxKhn1f4kJ4Lzr5hGh41EWIE9etP253aV57Nr4qS0/1zxI UyuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=on41Yi2+xoY+G+uabbJgG7qMBX10oGTBeGxN0tKESfk=; b=TDUL5IQ0oP+4dV6yUnO4MS1bIEpRHTzbxsx8MXLmAKfhwxDjXZWZx2kQGEgJWdhL4S Czt5yRMi7rorQh7Zdy3iO5w/sZMeuY9N5exxWtyFzXqUhib/S2BksWyqEPGyVzL7sWEX 0Q+6KSloViRCkadVbA3cOxiaKuTORUmrI8dBOwRQn3y59KIh3HKT5QT8YVhMUKN2T+CS Qj2Ny0+eblVQgup4EgCToH31Yny1P2zUiTyBR6Ey4ZyNBwBQuAPfEbN+y/bPnuT06qrt T8zFWoAHkiHoHouH+zwxM2gkCyO0J9pkSoCcWEfRWKQVub5jw0GDqXWoq9aXJeOsuKLa iSFg== 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 f3si18263618pfn.237.2019.05.07.05.33.52; Tue, 07 May 2019 05:34:08 -0700 (PDT) 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 S1726491AbfEGMc7 (ORCPT + 99 others); Tue, 7 May 2019 08:32:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:55620 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726206AbfEGMc7 (ORCPT ); Tue, 7 May 2019 08:32:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3E064AE14; Tue, 7 May 2019 12:32:58 +0000 (UTC) Date: Tue, 7 May 2019 14:32:57 +0200 (CEST) From: Miroslav Benes To: Petr Mladek cc: Jiri Kosina , Josh Poimboeuf , Joe Lawrence , Kamalesh Babulal , "Tobin C . Harding" , Greg Kroah-Hartman , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: Remove custom kobject state handling In-Reply-To: <20190503132625.23442-2-pmladek@suse.com> Message-ID: References: <20190503132625.23442-1-pmladek@suse.com> <20190503132625.23442-2-pmladek@suse.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 May 2019, Petr Mladek wrote: > kobject_init() always succeeds and sets the reference count to 1. > It allows to always free the structures via kobject_put() and > the related release callback. > > Note that the custom kobject state handling was used only > because we did not know that kobject_put() can and actually > should get called even when kobject_init_and_add() fails. > > The patch should not change the existing behavior. Pity that the changelog does not describe the change from kobject_init_and_add() to two-stage kobject init (separate kobject_init() and kobject_add()). Petr changed it, because now each member of new dynamic lists (created in klp_init_patch_early()) is initialized with kobject_init(), so we do not have to worry about calling kobject_put() (this is slightly different from kobj_added). It would also be possible to retain kobject_init_and_add() and move it to klp_init_patch_early(), but it would be uglier in my opinion. Miroslav