public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Eric Wong <normalperson@yhbt.net>,
	Jason Baron <jbaron@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] signals: eventpoll: set ->saved_sigmask at the start
Date: Tue, 25 Jun 2013 21:23:43 +0100	[thread overview]
Message-ID: <20130625202343.GA4165@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20130625195759.GA15252@redhat.com>

On Tue, Jun 25, 2013 at 09:57:59PM +0200, Oleg Nesterov wrote:
> +		current->saved_sigmask = current->blocked;
>  		set_current_blocked(&ksigmask);
>  	}
>  
>  	error = sys_epoll_wait(epfd, events, maxevents, timeout);
> -
>  	/*
>  	 * If we changed the signal mask, we need to restore the original one.
>  	 * In case we've got a signal while waiting, we do not restore the
> @@ -1988,12 +1988,10 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
>  	 * the way back to userspace, before the signal mask is restored.
>  	 */
>  	if (sigmask) {
> -		if (error == -EINTR) {
> -			memcpy(&current->saved_sigmask, &sigsaved,
> -			       sizeof(sigsaved));
> +		if (error == -EINTR)
>  			set_restore_sigmask();
> -		} else
> -			set_current_blocked(&sigsaved);
> +		else
> +			__set_current_blocked(&current->saved_sigmask);

I don't like that.  If anything, we have
static inline void restore_saved_sigmask(void)
{
        if (test_and_clear_restore_sigmask())
                __set_current_blocked(&current->saved_sigmask);
}
which means that the last part can be turned into
		set_restore_sigmask();
		if (error != -EINTR)
			restore_saved_sigmask();
and I'd pulled set_restore_sigmask() call next to setting the sucker.

  reply	other threads:[~2013-06-25 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 19:57 [PATCH 0/2] signals: eventpoll: save/restore_sigmask cleanups Oleg Nesterov
2013-06-25 19:57 ` [PATCH 1/2] signals: eventpoll: do not use sigprocmask() Oleg Nesterov
2013-06-25 19:57 ` [PATCH 2/2] signals: eventpoll: set ->saved_sigmask at the start Oleg Nesterov
2013-06-25 20:23   ` Al Viro [this message]
2013-06-25 20:32     ` Oleg Nesterov
2013-06-25 20:44       ` Oleg Nesterov
2013-06-26 16:48         ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130625202343.GA4165@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=dvlasenk@redhat.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox