lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 26 Jan 2023 21:14:16 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Rik van Riel <riel@...riel.com>
Cc:     linux-kernel@...r.kernel.org, kernel-team@...a.com,
        linux-fsdevel@...r.kernel.org, gscrivan@...hat.com,
        Chris Mason <clm@...a.com>
Subject: Re: [PATCH 2/2] ipc,namespace: batch free ipc_namespace structures

On Thu, Jan 26, 2023 at 03:57:21PM -0500, Rik van Riel wrote:
> Instead of waiting for an RCU grace period between each ipc_namespace
> structure that is being freed, wait an RCU grace period for every batch
> of ipc_namespace structures.
> 
> Thanks to Al Viro for the suggestion of the helper function.
> 
> This speeds up the run time of the test case that allocates ipc_namespaces
> in a loop from 6 minutes, to a little over 1 second:
> 
> real	0m1.192s
> user	0m0.038s
> sys	0m1.152s
> 
> Signed-off-by: Rik van Riel <riel@...riel.com>
> Reported-by: Chris Mason <clm@...a.com>
> Suggested-by: Al Viro <viro@...iv.linux.org.uk>

OK, except that I'd rather
	a) made it
	if (mnt)
		real_mount(mnt)->mnt_ns = NULL;
so that it would treat NULL as no-op and
	b) made kern_unmount() and kern_unmount_array() use it:
void kern_unmount(struct vfsmount *mnt)
{
        /* release long term mount so mount point can be released */
        if (!IS_ERR(mnt)) {
		mnt_make_shorterm(mnt);
                synchronize_rcu();      /* yecchhh... */
                mntput(mnt);
        }
}

void kern_unmount_array(struct vfsmount *mnt[], unsigned int num)
{
        unsigned int i;

        for (i = 0; i < num; i++)
		mnt_make_shorterm(mnt[i]);
        synchronize_rcu_expedited();
        for (i = 0; i < num; i++)
                mntput(mnt[i]);
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ