Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/03, Linus Torvalds wrote:
>
> There's currently a fair number of open-coded assignments:
>
>     git grep -E 'pipe->((tail)|(head)).*=' fs/
>
> and some of those are under specific locking rules together with other
> updates (ie the watch-queue 'note_loss' thing.

Stupid question... but do we really need to change the code which update
tail/head if we pack them into a single word?

I mean,

	-	unsigned int head;
	-	unsigned int tail;
	+	union {
	+		struct {
	+			u16 head, tail;
	+		}
	+
	+		__u32   head_tail;
	+	}

Now pipe_writebale() can read do READ_ONCE(pipe->head_tail) "atomically"
without preemption and this is all we need, no?

Yes, pipe_writable() should take endianess into account, but this is
simple...

Oleg





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux