Re: [PATCH][V3]Make get_user_pages interruptible

From: Pekka Enberg
Date: Mon Nov 24 2008 - 16:19:42 EST


On Fri, Nov 21, 2008 at 5:31 PM, Ying Han <yinghan@xxxxxxxxxx> wrote:
>>> */
>>> - if (unlikely(test_tsk_thread_flag(tsk, TIF_MEMDIE)))
>>> - return i ? i : -ENOMEM;
>>> + if (unlikely(sigkill_pending(tsk)))
>>> + return i ? i : -ERESTARTSYS;

On Mon, Nov 24, 2008 at 12:02 PM, Paul Menage <menage@xxxxxxxxxx> wrote:
>> You've changed the check from sigkill_pending(current) to sigkill_pending(tsk).
>>
>> I originally made that sigkill_pending(current) since we want to avoid
>> tasks entering an unkillable state just because they're doing
>> get_user_pages() on a system that's short of memory. Admittedly for
>> the main case that we care about, mlock() (or an mmap() with
>> MCL_FUTURE set) then tsk==current, but philosophically it seems to me
>> to be more correct to do the check against current than tsk, since
>> current is the thing that's actually allocating the memory. But maybe
>> it would be better to check both?

On Mon, Nov 24, 2008 at 11:02 PM, Ying Han <yinghan@xxxxxxxxxx> wrote:
> In most of cases, tsk==current in get_user_pages(), that is why i
> change current to tsk since
> tsk is a superset of current, no? If that is right, why we need to check both?

I'm not sure if it's strictly necessary but as I pointed out in the
other mail, there can be callers that are doing get_user_pages() on
behalf of other tasks and you probably want to be able to kill the
task that's actually _calling_ get_user_pages() as well.

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/